Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h

Issue 10908157: Integrate ChromeToMobile with GTK Action Box. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This is the GTK implementation of the Chrome To Mobile bubble, the transient 5 // This is the GTK implementation of the Chrome To Mobile bubble, the transient
6 // bubble presented to send URLs and MHTML snapshots to a mobile device. There 6 // bubble presented to send URLs and MHTML snapshots to a mobile device. There
7 // can only ever be a single bubble open, so the class presents only static 7 // can only ever be a single bubble open, so the class presents only static
8 // methods, and handles the singleton behavior for you. It also handles the 8 // methods, and handles the singleton behavior for you. It also handles the
9 // object and widget lifetimes, destroying everything when the bubble is closed. 9 // object and widget lifetimes, destroying everything when the bubble is closed.
10 10
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 typedef struct _GtkWidget GtkWidget; 39 typedef struct _GtkWidget GtkWidget;
40 40
41 class ChromeToMobileBubbleGtk : public BubbleDelegateGtk, 41 class ChromeToMobileBubbleGtk : public BubbleDelegateGtk,
42 public ui::AnimationDelegate, 42 public ui::AnimationDelegate,
43 public content::NotificationObserver, 43 public content::NotificationObserver,
44 public ChromeToMobileService::Observer { 44 public ChromeToMobileService::Observer {
45 public: 45 public:
46 // Shows the Chrome to Mobile bubble, pointing at |anchor_widget|. 46 // Shows the Chrome to Mobile bubble, pointing at |anchor_widget|.
47 // |anchor_image| is updated to show the lit icon during the bubble lifetime. 47 // TODO(msw): Show the lit mobile icon during the bubble lifetime.
48 static void Show(GtkImage* anchor_image, Browser* browser); 48 static void Show(GtkWidget* anchor_widget, Browser* browser);
49 49
50 // BubbleDelegateGtk: 50 // BubbleDelegateGtk:
51 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; 51 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
52 52
53 // ui::AnimationDelegate: 53 // ui::AnimationDelegate:
54 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 54 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
55 55
56 // content::NotificationObserver: 56 // content::NotificationObserver:
57 virtual void Observe(int type, 57 virtual void Observe(int type,
58 const content::NotificationSource& source, 58 const content::NotificationSource& source,
59 const content::NotificationDetails& details) OVERRIDE; 59 const content::NotificationDetails& details) OVERRIDE;
60 60
61 // ChromeToMobileService::Observer: 61 // ChromeToMobileService::Observer:
62 virtual void SnapshotGenerated(const FilePath& path, int64 bytes) OVERRIDE; 62 virtual void SnapshotGenerated(const FilePath& path, int64 bytes) OVERRIDE;
63 virtual void OnSendComplete(bool success) OVERRIDE; 63 virtual void OnSendComplete(bool success) OVERRIDE;
64 64
65 private: 65 private:
66 ChromeToMobileBubbleGtk(GtkImage* anchor_image, Browser* browser); 66 ChromeToMobileBubbleGtk(GtkWidget* anchor_widget, Browser* browser);
67 virtual ~ChromeToMobileBubbleGtk(); 67 virtual ~ChromeToMobileBubbleGtk();
68 68
69 // Notified when |content_| is destroyed so we can delete our instance. 69 // Notified when |content_| is destroyed so we can delete our instance.
70 CHROMEGTK_CALLBACK_0(ChromeToMobileBubbleGtk, void, OnDestroy); 70 CHROMEGTK_CALLBACK_0(ChromeToMobileBubbleGtk, void, OnDestroy);
71 CHROMEGTK_CALLBACK_0(ChromeToMobileBubbleGtk, void, OnLearnClicked); 71 CHROMEGTK_CALLBACK_0(ChromeToMobileBubbleGtk, void, OnLearnClicked);
72 CHROMEGTK_CALLBACK_0(ChromeToMobileBubbleGtk, void, OnCancelClicked); 72 CHROMEGTK_CALLBACK_0(ChromeToMobileBubbleGtk, void, OnCancelClicked);
73 CHROMEGTK_CALLBACK_0(ChromeToMobileBubbleGtk, void, OnSendClicked); 73 CHROMEGTK_CALLBACK_0(ChromeToMobileBubbleGtk, void, OnSendClicked);
74 74
75 base::WeakPtrFactory<ChromeToMobileBubbleGtk> weak_ptr_factory_; 75 base::WeakPtrFactory<ChromeToMobileBubbleGtk> weak_ptr_factory_;
76 76
77 // The browser that opened this bubble. 77 // The browser that opened this bubble.
78 Browser* browser_; 78 Browser* browser_;
79 79
80 // The Chrome To Mobile service associated with this bubble. 80 // The Chrome To Mobile service associated with this bubble.
81 ChromeToMobileService* service_; 81 ChromeToMobileService* service_;
82 82
83 // Support members for getting theme colors and theme change notifications. 83 // Support members for getting theme colors and theme change notifications.
84 GtkThemeService* theme_service_; 84 GtkThemeService* theme_service_;
85 content::NotificationRegistrar registrar_; 85 content::NotificationRegistrar registrar_;
86 86
87 // The file path for the MHTML page snapshot. 87 // The file path for the MHTML page snapshot.
88 FilePath snapshot_path_; 88 FilePath snapshot_path_;
89 89
90 // The list of radio buttons corresponding to the list of mobile devices. 90 // The list of radio buttons corresponding to the list of mobile devices.
91 std::vector<GtkWidget*> radio_buttons_; 91 std::vector<GtkWidget*> radio_buttons_;
92 92
93 // The anchor image, updated to show the lit icon during the bubble lifetime. 93 // The widget to which this bubble is anchored.
94 GtkImage* anchor_image_; 94 GtkWidget* anchor_widget_;
95 95
96 // The labels in the bubble; tracked for theme changes. 96 // The labels in the bubble; tracked for theme changes.
97 std::vector<GtkWidget*> labels_; 97 std::vector<GtkWidget*> labels_;
98 98
99 GtkWidget* send_copy_; 99 GtkWidget* send_copy_;
100 GtkWidget* learn_; 100 GtkWidget* learn_;
101 GtkWidget* cancel_; 101 GtkWidget* cancel_;
102 GtkWidget* send_; 102 GtkWidget* send_;
103 GtkWidget* error_; 103 GtkWidget* error_;
104 104
105 // The actual BubbleGtk shown by this class and its content. 105 // The actual BubbleGtk shown by this class and its content.
106 BubbleGtk* bubble_; 106 BubbleGtk* bubble_;
107 107
108 // An animation used to cycle through the "Sending..." status messages. 108 // An animation used to cycle through the "Sending..." status messages.
109 scoped_ptr<ui::ThrobAnimation> progress_animation_; 109 scoped_ptr<ui::ThrobAnimation> progress_animation_;
110 110
111 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileBubbleGtk); 111 DISALLOW_COPY_AND_ASSIGN(ChromeToMobileBubbleGtk);
112 }; 112 };
113 113
114 #endif // CHROME_BROWSER_UI_GTK_CHROME_TO_MOBILE_BUBBLE_GTK_H_ 114 #endif // CHROME_BROWSER_UI_GTK_CHROME_TO_MOBILE_BUBBLE_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698