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

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

Issue 10835020: Refactor location bar content setting image GTK classes to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 #ifndef CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ 6 #define CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 virtual void Observe(int type, 161 virtual void Observe(int type,
162 const content::NotificationSource& source, 162 const content::NotificationSource& source,
163 const content::NotificationDetails& details) OVERRIDE; 163 const content::NotificationDetails& details) OVERRIDE;
164 164
165 // CommandObserver: 165 // CommandObserver:
166 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; 166 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE;
167 167
168 // Edit background color. 168 // Edit background color.
169 static const GdkColor kBackgroundColor; 169 static const GdkColor kBackgroundColor;
170 170
171 private: 171 // Superclass for content settings icons shown at the left side of the
172 class ContentSettingImageViewGtk : public BubbleDelegateGtk, 172 // location bar.
173 public ui::AnimationDelegate { 173 class PageToolViewGtk : public ui::AnimationDelegate {
174 public: 174 public:
175 ContentSettingImageViewGtk(ContentSettingsType content_type, 175 explicit PageToolViewGtk(const LocationBarViewGtk* parent);
176 const LocationBarViewGtk* parent); 176 virtual ~PageToolViewGtk();
177 virtual ~ContentSettingImageViewGtk();
178 177
179 GtkWidget* widget() { return alignment_.get(); } 178 GtkWidget* widget();
180 179
181 bool IsVisible(); 180 bool IsVisible();
182 void UpdateFromWebContents(content::WebContents* web_contents); 181 virtual void Update(TabContents* tab_contents) = 0;
183 182
184 // Overridden from ui::AnimationDelegate: 183 // Overridden from ui::AnimationDelegate:
185 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 184 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
186 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 185 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
187 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; 186 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE;
188 187
189 private: 188 protected:
189 // Theme constants for solid background elements.
190 virtual GdkColor button_border_color() const = 0;
191 virtual GdkColor gradient_top_color() const = 0;
192 virtual GdkColor gradient_bottom_color() const = 0;
193
194 // Delegate for ButtonPressed message.
195 virtual void OnClick(GtkWidget* sender) = 0;
196
190 // Start the process of showing the label. 197 // Start the process of showing the label.
191 void StartAnimating(); 198 void StartAnimating();
192 199
193 // Slide the label shut. 200 // Slide the label shut.
194 void CloseAnimation(); 201 void CloseAnimation();
195 202
196 CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnButtonPressed, 203 CHROMEGTK_CALLBACK_1(PageToolViewGtk, gboolean, OnButtonPressed, GdkEvent*);
197 GdkEvent*); 204 CHROMEGTK_CALLBACK_1(PageToolViewGtk, gboolean, OnExpose, GdkEventExpose*);
198 CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnExpose,
199 GdkEventExpose*);
200 205
201 // BubbleDelegateGtk overrides: 206 // The widgets for this view.
202 virtual void BubbleClosing(BubbleGtk* bubble,
203 bool closed_by_escape) OVERRIDE;
204
205 scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
206
207 // The widgets for this content settings view.
208 ui::OwnedWidgetGtk alignment_; 207 ui::OwnedWidgetGtk alignment_;
209 ui::OwnedWidgetGtk event_box_; 208 ui::OwnedWidgetGtk event_box_;
210 GtkWidget* hbox_; 209 GtkWidget* hbox_;
211 ui::OwnedWidgetGtk image_; 210 ui::OwnedWidgetGtk image_;
212 211
213 // Explanatory text ("popup blocked"). 212 // Explanatory text (e.g. "popup blocked").
214 ui::OwnedWidgetGtk label_; 213 ui::OwnedWidgetGtk label_;
215 214
216 // The owning LocationBarViewGtk. 215 // The owning LocationBarViewGtk.
217 const LocationBarViewGtk* parent_; 216 const LocationBarViewGtk* parent_;
218 217
219 // The currently shown bubble if any.
220 ContentSettingBubbleGtk* content_setting_bubble_;
221
222 // When we show explanatory text, we slide it in/out. 218 // When we show explanatory text, we slide it in/out.
223 ui::SlideAnimation animation_; 219 ui::SlideAnimation animation_;
224 220
225 // The label's default requisition (cached so we can animate accordingly). 221 // The label's default requisition (cached so we can animate accordingly).
226 GtkRequisition label_req_; 222 GtkRequisition label_req_;
227 223
228 base::WeakPtrFactory<ContentSettingImageViewGtk> weak_factory_; 224 base::WeakPtrFactory<PageToolViewGtk> weak_factory_;
229 225
230 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk); 226 private:
227 DISALLOW_COPY_AND_ASSIGN(PageToolViewGtk);
231 }; 228 };
232 229
230 private:
233 class PageActionViewGtk : 231 class PageActionViewGtk :
234 public ImageLoadingTracker::Observer, 232 public ImageLoadingTracker::Observer,
235 public content::NotificationObserver, 233 public content::NotificationObserver,
236 public ExtensionContextMenuModel::PopupDelegate, 234 public ExtensionContextMenuModel::PopupDelegate,
237 public ExtensionAction::IconAnimation::Observer { 235 public ExtensionAction::IconAnimation::Observer {
238 public: 236 public:
239 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); 237 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action);
240 virtual ~PageActionViewGtk(); 238 virtual ~PageActionViewGtk();
241 239
242 GtkWidget* widget() { return event_box_.get(); } 240 GtkWidget* widget() { return event_box_.get(); }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 GtkWidget* site_type_event_box_; 453 GtkWidget* site_type_event_box_;
456 GtkWidget* location_icon_image_; 454 GtkWidget* location_icon_image_;
457 GtkWidget* drag_icon_; 455 GtkWidget* drag_icon_;
458 bool enable_location_drag_; 456 bool enable_location_drag_;
459 // TODO(pkasting): Split this label off and move the rest of the items to the 457 // TODO(pkasting): Split this label off and move the rest of the items to the
460 // left of the address bar. 458 // left of the address bar.
461 GtkWidget* security_info_label_; 459 GtkWidget* security_info_label_;
462 460
463 // Content setting icons. 461 // Content setting icons.
464 ui::OwnedWidgetGtk content_setting_hbox_; 462 ui::OwnedWidgetGtk content_setting_hbox_;
465 ScopedVector<ContentSettingImageViewGtk> content_setting_views_; 463 ScopedVector<PageToolViewGtk> content_setting_views_;
466 464
467 // Extension page actions. 465 // Extension page actions.
468 std::vector<ExtensionAction*> page_actions_; 466 std::vector<ExtensionAction*> page_actions_;
469 467
470 // Extension page action icons. 468 // Extension page action icons.
471 ui::OwnedWidgetGtk page_action_hbox_; 469 ui::OwnedWidgetGtk page_action_hbox_;
472 ScopedVector<PageActionViewGtk> page_action_views_; 470 ScopedVector<PageActionViewGtk> page_action_views_;
473 471
474 // The widget that contains our tab hints and the location bar. 472 // The widget that contains our tab hints and the location bar.
475 GtkWidget* entry_box_; 473 GtkWidget* entry_box_;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 BooleanPrefMember edit_bookmarks_enabled_; 537 BooleanPrefMember edit_bookmarks_enabled_;
540 538
541 // Used to remember the URL and title text when drag&drop has begun. 539 // Used to remember the URL and title text when drag&drop has begun.
542 GURL drag_url_; 540 GURL drag_url_;
543 string16 drag_title_; 541 string16 drag_title_;
544 542
545 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); 543 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk);
546 }; 544 };
547 545
548 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ 546 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/location_bar_view_gtk.cc » ('j') | chrome/browser/ui/gtk/location_bar_view_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698