]> khamidou — GitHub mirrors - electron.git/commitdiff
Add dummy implementations for TrayIcon.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 30 May 2014 02:31:27 +0000 (10:31 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 30 May 2014 02:31:27 +0000 (10:31 +0800)
atom.gyp
atom/browser/ui/tray_icon.cc [new file with mode: 0644]
atom/browser/ui/tray_icon.h [new file with mode: 0644]
atom/browser/ui/tray_icon_cocoa.h [new file with mode: 0644]
atom/browser/ui/tray_icon_cocoa.mm [new file with mode: 0644]
atom/browser/ui/tray_icon_gtk.cc [new file with mode: 0644]
atom/browser/ui/tray_icon_gtk.h [new file with mode: 0644]
atom/browser/ui/tray_icon_win.cc [new file with mode: 0644]
atom/browser/ui/tray_icon_win.h [new file with mode: 0644]

index 3c95bf0904a23bbb276cf4c52e67e980b39592aa..426d9bf054314227bbab627a706b0a826148fcfd 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
       'atom/browser/ui/message_box_gtk.cc',
       'atom/browser/ui/message_box_mac.mm',
       'atom/browser/ui/message_box_win.cc',
+      'atom/browser/ui/tray_icon.cc',
+      'atom/browser/ui/tray_icon.h',
+      'atom/browser/ui/tray_icon_gtk.cc',
+      'atom/browser/ui/tray_icon_gtk.h',
+      'atom/browser/ui/tray_icon_cocoa.h',
+      'atom/browser/ui/tray_icon_cocoa.mm',
+      'atom/browser/ui/tray_icon_win.cc',
+      'atom/browser/ui/tray_icon_win.h',
       'atom/browser/ui/win/menu_2.cc',
       'atom/browser/ui/win/menu_2.h',
       'atom/browser/ui/win/native_menu_win.cc',
diff --git a/atom/browser/ui/tray_icon.cc b/atom/browser/ui/tray_icon.cc
new file mode 100644 (file)
index 0000000..5b70775
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "atom/browser/ui/tray_icon.h"
+
+namespace atom {
+
+TrayIcon::TrayIcon() : model_(NULL) {
+}
+
+TrayIcon::~TrayIcon() {
+}
+
+void TrayIcon::SetContextMenu(ui::SimpleMenuModel* menu_model) {
+  model_ = menu_model;
+}
+
+}  // namespace atom
diff --git a/atom/browser/ui/tray_icon.h b/atom/browser/ui/tray_icon.h
new file mode 100644 (file)
index 0000000..69cdba2
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_BROWSER_UI_TRAY_ICON_H_
+#define ATOM_BROWSER_UI_TRAY_ICON_H_
+
+#include <string>
+
+#include "ui/base/models/simple_menu_model.h"
+
+namespace atom {
+
+class TrayIcon {
+ public:
+  static TrayIcon* Create();
+
+  // Sets the image associated with this status icon.
+  virtual void SetImage(const gfx::ImageSkia& image) = 0;
+
+  // Sets the image associated with this status icon when pressed.
+  virtual void SetPressedImage(const gfx::ImageSkia& image) = 0;
+
+  // Sets the hover text for this status icon. This is also used as the label
+  // for the menu item which is created as a replacement for the status icon
+  // click action on platforms that do not support custom click actions for the
+  // status icon (e.g. Ubuntu Unity).
+  virtual void SetToolTip(const std::string& tool_tip) = 0;
+
+  // Set the context menu for this icon.
+  void SetContextMenu(ui::SimpleMenuModel* menu_model);
+
+ protected:
+  TrayIcon();
+  virtual ~TrayIcon();
+
+ private:
+  ui::SimpleMenuModel* model_;  // Weak reference.
+
+  DISALLOW_COPY_AND_ASSIGN(TrayIcon);
+};
+
+}  // namespace atom
+
+#endif  // ATOM_BROWSER_UI_TRAY_ICON_H_
diff --git a/atom/browser/ui/tray_icon_cocoa.h b/atom/browser/ui/tray_icon_cocoa.h
new file mode 100644 (file)
index 0000000..73da462
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_BROWSER_UI_TRAY_ICON_COCOA_H_
+#define ATOM_BROWSER_UI_TRAY_ICON_COCOA_H_
+
+#include <string>
+
+#include "atom/browser/ui/tray_icon.h"
+
+namespace atom {
+
+class TrayIconCocoa : public TrayIcon {
+ public:
+  virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
+  virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
+  virtual void SetToolTip(const std::string& tool_tip) OVERRIDE;
+
+ private:
+  TrayIconCocoa();
+  virtual ~TrayIconCocoa();
+
+  DISALLOW_COPY_AND_ASSIGN(TrayIconCocoa);
+};
+
+}  // namespace atom
+
+#endif  // ATOM_BROWSER_UI_TRAY_ICON_COCOA_H_
diff --git a/atom/browser/ui/tray_icon_cocoa.mm b/atom/browser/ui/tray_icon_cocoa.mm
new file mode 100644 (file)
index 0000000..ff3aa46
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "atom/browser/ui/tray_icon_cocoa.h"
+
+namespace atom {
+
+TrayIconCocoa::TrayIconCocoa() {
+}
+
+TrayIconCocoa::~TrayIconCocoa() {
+}
+
+void TrayIconCocoa::SetImage(const gfx::ImageSkia& image) {
+}
+
+void TrayIconCocoa::SetPressedImage(const gfx::ImageSkia& image) {
+}
+
+void TrayIconCocoa::SetToolTip(const std::string& tool_tip) {
+}
+
+}  // namespace atom
diff --git a/atom/browser/ui/tray_icon_gtk.cc b/atom/browser/ui/tray_icon_gtk.cc
new file mode 100644 (file)
index 0000000..1a61b2f
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "atom/browser/ui/tray_icon_gtk.h"
+
+namespace atom {
+
+TrayIconGtk::TrayIconGtk() {
+}
+
+TrayIconGtk::~TrayIconGtk() {
+}
+
+void TrayIconGtk::SetImage(const gfx::ImageSkia& image) {
+}
+
+void TrayIconGtk::SetPressedImage(const gfx::ImageSkia& image) {
+}
+
+void TrayIconGtk::SetToolTip(const std::string& tool_tip) {
+}
+
+}  // namespace atom
diff --git a/atom/browser/ui/tray_icon_gtk.h b/atom/browser/ui/tray_icon_gtk.h
new file mode 100644 (file)
index 0000000..b4845ad
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_BROWSER_UI_TRAY_ICON_GTK_H_
+#define ATOM_BROWSER_UI_TRAY_ICON_GTK_H_
+
+#include <string>
+
+#include "atom/browser/ui/tray_icon.h"
+
+namespace atom {
+
+class TrayIconGtk : public TrayIcon {
+ public:
+  virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
+  virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
+  virtual void SetToolTip(const std::string& tool_tip) OVERRIDE;
+
+ private:
+  TrayIconGtk();
+  virtual ~TrayIconGtk();
+
+  DISALLOW_COPY_AND_ASSIGN(TrayIconGtk);
+};
+
+}  // namespace atom
+
+#endif  // ATOM_BROWSER_UI_TRAY_ICON_GTK_H_
diff --git a/atom/browser/ui/tray_icon_win.cc b/atom/browser/ui/tray_icon_win.cc
new file mode 100644 (file)
index 0000000..21bf2f6
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "atom/browser/ui/tray_icon_win.h"
+
+namespace atom {
+
+TrayIconWin::TrayIconWin() {
+}
+
+TrayIconWin::~TrayIconWin() {
+}
+
+void TrayIconWin::SetImage(const gfx::ImageSkia& image) {
+}
+
+void TrayIconWin::SetPressedImage(const gfx::ImageSkia& image) {
+}
+
+void TrayIconWin::SetToolTip(const std::string& tool_tip) {
+}
+
+}  // namespace atom
diff --git a/atom/browser/ui/tray_icon_win.h b/atom/browser/ui/tray_icon_win.h
new file mode 100644 (file)
index 0000000..4724e49
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (c) 2014 GitHub, Inc. All rights reserved.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_BROWSER_UI_TRAY_ICON_WIN_H_
+#define ATOM_BROWSER_UI_TRAY_ICON_WIN_H_
+
+#include <string>
+
+#include "atom/browser/ui/tray_icon.h"
+
+namespace atom {
+
+class TrayIconWin : public TrayIcon {
+ public:
+  virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
+  virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
+  virtual void SetToolTip(const std::string& tool_tip) OVERRIDE;
+
+ private:
+  TrayIconWin();
+  virtual ~TrayIconWin();
+
+  DISALLOW_COPY_AND_ASSIGN(TrayIconWin);
+};
+
+}  // namespace atom
+
+#endif  // ATOM_BROWSER_UI_TRAY_ICON_WIN_H_