Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 InstantCompleteBehavior behavior) OVERRIDE; | 137 InstantCompleteBehavior behavior) OVERRIDE; |
| 138 virtual string16 GetInputString() const OVERRIDE; | 138 virtual string16 GetInputString() const OVERRIDE; |
| 139 virtual WindowOpenDisposition GetWindowOpenDisposition() const OVERRIDE; | 139 virtual WindowOpenDisposition GetWindowOpenDisposition() const OVERRIDE; |
| 140 virtual content::PageTransition GetPageTransition() const OVERRIDE; | 140 virtual content::PageTransition GetPageTransition() const OVERRIDE; |
| 141 virtual void AcceptInput() OVERRIDE; | 141 virtual void AcceptInput() OVERRIDE; |
| 142 virtual void FocusLocation(bool select_all) OVERRIDE; | 142 virtual void FocusLocation(bool select_all) OVERRIDE; |
| 143 virtual void FocusSearch() OVERRIDE; | 143 virtual void FocusSearch() OVERRIDE; |
| 144 virtual void UpdateContentSettingsIcons() OVERRIDE; | 144 virtual void UpdateContentSettingsIcons() OVERRIDE; |
| 145 virtual void UpdatePageActions() OVERRIDE; | 145 virtual void UpdatePageActions() OVERRIDE; |
| 146 virtual void InvalidatePageActions() OVERRIDE; | 146 virtual void InvalidatePageActions() OVERRIDE; |
| 147 virtual void UpdateWebIntentsTool() OVERRIDE; | |
| 147 virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE; | 148 virtual void SaveStateToContents(content::WebContents* contents) OVERRIDE; |
| 148 virtual void Revert() OVERRIDE; | 149 virtual void Revert() OVERRIDE; |
| 149 virtual const OmniboxView* GetLocationEntry() const OVERRIDE; | 150 virtual const OmniboxView* GetLocationEntry() const OVERRIDE; |
| 150 virtual OmniboxView* GetLocationEntry() OVERRIDE; | 151 virtual OmniboxView* GetLocationEntry() OVERRIDE; |
| 151 virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE; | 152 virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE; |
| 152 | 153 |
| 153 // LocationBarTesting: | 154 // LocationBarTesting: |
| 154 virtual int PageActionCount() OVERRIDE; | 155 virtual int PageActionCount() OVERRIDE; |
| 155 virtual int PageActionVisibleCount() OVERRIDE; | 156 virtual int PageActionVisibleCount() OVERRIDE; |
| 156 virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE; | 157 virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE; |
| 157 virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE; | 158 virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE; |
| 158 virtual void TestPageActionPressed(size_t index) OVERRIDE; | 159 virtual void TestPageActionPressed(size_t index) OVERRIDE; |
| 159 | 160 |
| 160 // content::NotificationObserver: | 161 // content::NotificationObserver: |
| 161 virtual void Observe(int type, | 162 virtual void Observe(int type, |
| 162 const content::NotificationSource& source, | 163 const content::NotificationSource& source, |
| 163 const content::NotificationDetails& details) OVERRIDE; | 164 const content::NotificationDetails& details) OVERRIDE; |
| 164 | 165 |
| 165 // CommandObserver: | 166 // CommandObserver: |
| 166 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; | 167 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; |
| 167 | 168 |
| 168 // Edit background color. | 169 // Edit background color. |
| 169 static const GdkColor kBackgroundColor; | 170 static const GdkColor kBackgroundColor; |
| 170 | 171 |
| 171 private: | 172 private: |
| 172 class ContentSettingImageViewGtk : public BubbleDelegateGtk, | 173 // TODO(gbillock): cause this public interface to be a platform-independent |
| 173 public ui::AnimationDelegate { | 174 // model interface for all the tools displayed in the location bar. |
| 175 class PageToolViewGtk : public ui::AnimationDelegate { | |
| 174 public: | 176 public: |
| 175 ContentSettingImageViewGtk(ContentSettingsType content_type, | 177 PageToolViewGtk(const LocationBarViewGtk* parent); |
| 176 const LocationBarViewGtk* parent); | 178 virtual ~PageToolViewGtk(); |
| 177 virtual ~ContentSettingImageViewGtk(); | |
| 178 | 179 |
| 179 GtkWidget* widget() { return alignment_.get(); } | 180 GtkWidget* widget(); |
| 180 | 181 |
| 181 bool IsVisible(); | 182 bool IsVisible(); |
| 182 void UpdateFromWebContents(content::WebContents* web_contents); | 183 virtual void Update(TabContents* tab_contents); |
| 183 | 184 |
| 184 // Overridden from ui::AnimationDelegate: | 185 // Overridden from ui::AnimationDelegate: |
| 185 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 186 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 186 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 187 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 187 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; | 188 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; |
| 188 | 189 |
| 189 private: | 190 protected: |
| 191 // Theme constants for solid background elements. | |
| 192 virtual GdkColor button_border_color() const; | |
| 193 virtual GdkColor gradient_top_color() const; | |
| 194 virtual GdkColor gradient_bottom_color() const; | |
| 195 | |
| 190 // Start the process of showing the label. | 196 // Start the process of showing the label. |
| 191 void StartAnimating(); | 197 void StartAnimating(); |
| 192 | 198 |
| 193 // Slide the label shut. | 199 // Slide the label shut. |
| 194 void CloseAnimation(); | 200 void CloseAnimation(); |
| 195 | 201 |
| 196 CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnButtonPressed, | 202 CHROMEGTK_CALLBACK_1(PageToolViewGtk, gboolean, OnButtonPressed, GdkEvent*); |
| 197 GdkEvent*); | 203 CHROMEGTK_CALLBACK_1(PageToolViewGtk, gboolean, OnExpose, GdkEventExpose*); |
| 198 CHROMEGTK_CALLBACK_1(ContentSettingImageViewGtk, gboolean, OnExpose, | 204 |
| 199 GdkEventExpose*); | 205 // Delegate for ButtonPressed message. |
| 206 virtual void OnClick(GtkWidget* sender); | |
| 207 | |
| 208 // The widgets for this view. | |
| 209 ui::OwnedWidgetGtk alignment_; | |
| 210 ui::OwnedWidgetGtk event_box_; | |
| 211 GtkWidget* hbox_; | |
| 212 ui::OwnedWidgetGtk image_; | |
| 213 | |
| 214 // Explanatory text (e.g. "popup blocked"). | |
| 215 ui::OwnedWidgetGtk label_; | |
| 216 | |
| 217 // The owning LocationBarViewGtk. | |
| 218 const LocationBarViewGtk* parent_; | |
| 219 | |
| 220 // When we show explanatory text, we slide it in/out. | |
| 221 ui::SlideAnimation animation_; | |
| 222 | |
| 223 // The label's default requisition (cached so we can animate accordingly). | |
| 224 GtkRequisition label_req_; | |
| 225 | |
| 226 base::WeakPtrFactory<PageToolViewGtk> weak_factory_; | |
| 227 | |
| 228 private: | |
| 229 DISALLOW_COPY_AND_ASSIGN(PageToolViewGtk); | |
| 230 }; | |
| 231 | |
| 232 class ContentSettingImageViewGtk : public PageToolViewGtk, | |
| 233 public BubbleDelegateGtk { | |
| 234 public: | |
| 235 ContentSettingImageViewGtk(ContentSettingsType content_type, | |
| 236 const LocationBarViewGtk* parent); | |
| 237 virtual ~ContentSettingImageViewGtk(); | |
| 238 | |
| 239 virtual void Update(TabContents* tab_contents) OVERRIDE; | |
|
Bernhard Bauer
2012/07/27 00:35:38
Add a comment which class this overrides?
| |
| 240 | |
| 241 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | |
| 242 | |
| 243 private: | |
| 244 virtual GdkColor button_border_color() const OVERRIDE; | |
| 245 virtual GdkColor gradient_top_color() const OVERRIDE; | |
| 246 virtual GdkColor gradient_bottom_color() const OVERRIDE; | |
| 247 virtual void OnClick(GtkWidget* sender) OVERRIDE; | |
| 200 | 248 |
| 201 // BubbleDelegateGtk overrides: | 249 // BubbleDelegateGtk overrides: |
| 202 virtual void BubbleClosing(BubbleGtk* bubble, | 250 virtual void BubbleClosing(BubbleGtk* bubble, |
| 203 bool closed_by_escape) OVERRIDE; | 251 bool closed_by_escape) OVERRIDE; |
| 204 | 252 |
| 205 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; | 253 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; |
| 206 | 254 |
| 207 // The widgets for this content settings view. | |
| 208 ui::OwnedWidgetGtk alignment_; | |
| 209 ui::OwnedWidgetGtk event_box_; | |
| 210 GtkWidget* hbox_; | |
| 211 ui::OwnedWidgetGtk image_; | |
| 212 | |
| 213 // Explanatory text ("popup blocked"). | |
| 214 ui::OwnedWidgetGtk label_; | |
| 215 | |
| 216 // The owning LocationBarViewGtk. | |
| 217 const LocationBarViewGtk* parent_; | |
| 218 | |
| 219 // The currently shown bubble if any. | 255 // The currently shown bubble if any. |
| 220 ContentSettingBubbleGtk* content_setting_bubble_; | 256 ContentSettingBubbleGtk* content_setting_bubble_; |
| 221 | 257 |
| 222 // When we show explanatory text, we slide it in/out. | |
| 223 ui::SlideAnimation animation_; | |
| 224 | |
| 225 // The label's default requisition (cached so we can animate accordingly). | |
| 226 GtkRequisition label_req_; | |
| 227 | |
| 228 base::WeakPtrFactory<ContentSettingImageViewGtk> weak_factory_; | |
| 229 | |
| 230 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk); | 258 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk); |
| 231 }; | 259 }; |
| 232 | 260 |
| 233 class PageActionViewGtk : | 261 class PageActionViewGtk : |
| 234 public ImageLoadingTracker::Observer, | 262 public ImageLoadingTracker::Observer, |
| 235 public content::NotificationObserver, | 263 public content::NotificationObserver, |
| 236 public ExtensionContextMenuModel::PopupDelegate, | 264 public ExtensionContextMenuModel::PopupDelegate, |
| 237 public ExtensionAction::IconAnimation::Observer { | 265 public ExtensionAction::IconAnimation::Observer { |
| 238 public: | 266 public: |
| 239 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); | 267 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 ui::OwnedWidgetGtk content_setting_hbox_; | 492 ui::OwnedWidgetGtk content_setting_hbox_; |
| 465 ScopedVector<ContentSettingImageViewGtk> content_setting_views_; | 493 ScopedVector<ContentSettingImageViewGtk> content_setting_views_; |
| 466 | 494 |
| 467 // Extension page actions. | 495 // Extension page actions. |
| 468 std::vector<ExtensionAction*> page_actions_; | 496 std::vector<ExtensionAction*> page_actions_; |
| 469 | 497 |
| 470 // Extension page action icons. | 498 // Extension page action icons. |
| 471 ui::OwnedWidgetGtk page_action_hbox_; | 499 ui::OwnedWidgetGtk page_action_hbox_; |
| 472 ScopedVector<PageActionViewGtk> page_action_views_; | 500 ScopedVector<PageActionViewGtk> page_action_views_; |
| 473 | 501 |
| 502 // Control for web intents window disposition picker control. | |
| 503 ui::OwnedWidgetGtk web_intents_hbox_; | |
| 504 PageToolViewGtk web_intents_tool_view_; | |
| 505 | |
| 474 // The widget that contains our tab hints and the location bar. | 506 // The widget that contains our tab hints and the location bar. |
| 475 GtkWidget* entry_box_; | 507 GtkWidget* entry_box_; |
| 476 | 508 |
| 477 // Area on the left shown when in tab to search mode. | 509 // Area on the left shown when in tab to search mode. |
| 478 GtkWidget* tab_to_search_alignment_; | 510 GtkWidget* tab_to_search_alignment_; |
| 479 GtkWidget* tab_to_search_box_; | 511 GtkWidget* tab_to_search_box_; |
| 480 GtkWidget* tab_to_search_magnifier_; | 512 GtkWidget* tab_to_search_magnifier_; |
| 481 GtkWidget* tab_to_search_full_label_; | 513 GtkWidget* tab_to_search_full_label_; |
| 482 GtkWidget* tab_to_search_partial_label_; | 514 GtkWidget* tab_to_search_partial_label_; |
| 483 | 515 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 BooleanPrefMember edit_bookmarks_enabled_; | 571 BooleanPrefMember edit_bookmarks_enabled_; |
| 540 | 572 |
| 541 // Used to remember the URL and title text when drag&drop has begun. | 573 // Used to remember the URL and title text when drag&drop has begun. |
| 542 GURL drag_url_; | 574 GURL drag_url_; |
| 543 string16 drag_title_; | 575 string16 drag_title_; |
| 544 | 576 |
| 545 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); | 577 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); |
| 546 }; | 578 }; |
| 547 | 579 |
| 548 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ | 580 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ |
| OLD | NEW |