| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <set> | |
| 13 #include <string> | 12 #include <string> |
| 14 | 13 |
| 15 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 16 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 17 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 19 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 21 #include "chrome/browser/command_updater.h" | 20 #include "chrome/browser/command_updater.h" |
| 22 #include "chrome/browser/extensions/action_box_controller.h" | |
| 23 #include "chrome/browser/extensions/extension_context_menu_model.h" | 21 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 24 #include "chrome/browser/extensions/image_loading_tracker.h" | 22 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 25 #include "chrome/browser/prefs/pref_member.h" | 23 #include "chrome/browser/prefs/pref_member.h" |
| 26 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 24 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 27 #include "chrome/browser/ui/gtk/menu_gtk.h" | 25 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 28 #include "chrome/browser/ui/omnibox/location_bar.h" | 26 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 29 #include "chrome/common/content_settings_types.h" | 27 #include "chrome/common/content_settings_types.h" |
| 30 #include "content/public/browser/notification_observer.h" | 28 #include "content/public/browser/notification_observer.h" |
| 31 #include "content/public/browser/notification_registrar.h" | 29 #include "content/public/browser/notification_registrar.h" |
| 32 #include "content/public/common/page_transition_types.h" | 30 #include "content/public/common/page_transition_types.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 GtkWidget* location_icon_widget() const { return location_icon_image_; } | 71 GtkWidget* location_icon_widget() const { return location_icon_image_; } |
| 74 | 72 |
| 75 // Returns the widget the extension installed bubble should point to. | 73 // Returns the widget the extension installed bubble should point to. |
| 76 GtkWidget* location_entry_widget() const { return entry_box_; } | 74 GtkWidget* location_entry_widget() const { return entry_box_; } |
| 77 | 75 |
| 78 Browser* browser() const { return browser_; } | 76 Browser* browser() const { return browser_; } |
| 79 | 77 |
| 80 // Returns the current WebContents. | 78 // Returns the current WebContents. |
| 81 content::WebContents* GetWebContents() const; | 79 content::WebContents* GetWebContents() const; |
| 82 | 80 |
| 83 // If |preview_enabled| is true, the view will display the | 81 // Sets |preview_enabled| for the PageActionViewGtk associated with this |
| 82 // |page_action|. If |preview_enabled| is true, the view will display the |
| 83 // page action's icon even though it has not been activated by the extension. |
| 84 // This is used by the ExtensionInstalledBubbleGtk to preview what the icon | 84 // This is used by the ExtensionInstalledBubbleGtk to preview what the icon |
| 85 // page action's icon even though it has not been activated by the extension. | |
| 86 // will look like for the user upon installation of the extension. | 85 // will look like for the user upon installation of the extension. |
| 87 void SetPreviewEnabledPageAction(ExtensionAction *page_action, | 86 void SetPreviewEnabledPageAction(ExtensionAction *page_action, |
| 88 bool preview_enabled); | 87 bool preview_enabled); |
| 89 | 88 |
| 90 // Retrieves the GtkWidget which is associated with PageActionView | 89 // Retrieves the GtkWidget which is associated with PageActionView |
| 91 // corresponding to |page_action|. | 90 // corresponding to |page_action|. |
| 92 GtkWidget* GetPageActionWidget(ExtensionAction* page_action); | 91 GtkWidget* GetPageActionWidget(ExtensionAction* page_action); |
| 93 | 92 |
| 94 // Updates the location bar. We also reset the bar's permanent text and | 93 // Updates the location bar. We also reset the bar's permanent text and |
| 95 // security style, and, if |tab_for_state_restoring| is non-NULL, also | 94 // security style, and, if |tab_for_state_restoring| is non-NULL, also |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 class PageActionViewGtk : public ImageLoadingTracker::Observer, | 221 class PageActionViewGtk : public ImageLoadingTracker::Observer, |
| 223 public content::NotificationObserver { | 222 public content::NotificationObserver { |
| 224 public: | 223 public: |
| 225 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); | 224 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); |
| 226 virtual ~PageActionViewGtk(); | 225 virtual ~PageActionViewGtk(); |
| 227 | 226 |
| 228 GtkWidget* widget() { return event_box_.get(); } | 227 GtkWidget* widget() { return event_box_.get(); } |
| 229 | 228 |
| 230 ExtensionAction* page_action() { return page_action_; } | 229 ExtensionAction* page_action() { return page_action_; } |
| 231 | 230 |
| 232 // Called to notify the PageAction that it should update based on the state | 231 void set_preview_enabled(bool preview_enabled) { |
| 233 // of |page_action_|. |contents| is the WebContents that is active, |url| | 232 preview_enabled_ = preview_enabled; |
| 233 } |
| 234 |
| 235 bool IsVisible(); |
| 236 |
| 237 // Called to notify the PageAction that it should determine whether to be |
| 238 // visible or hidden. |contents| is the WebContents that is active, |url| |
| 234 // is the current page URL. | 239 // is the current page URL. |
| 235 void Update(content::WebContents* contents, const GURL& url); | 240 void UpdateVisibility(content::WebContents* contents, const GURL& url); |
| 236 | 241 |
| 237 // A callback from ImageLoadingTracker for when the image has loaded. | 242 // A callback from ImageLoadingTracker for when the image has loaded. |
| 238 virtual void OnImageLoaded(const gfx::Image& image, | 243 virtual void OnImageLoaded(const gfx::Image& image, |
| 239 const std::string& extension_id, | 244 const std::string& extension_id, |
| 240 int index) OVERRIDE; | 245 int index) OVERRIDE; |
| 241 | 246 |
| 242 // Simulate left mouse click on the page action button. | 247 // Simulate left mouse click on the page action button. |
| 243 void TestActivatePageAction(); | 248 void TestActivatePageAction(); |
| 244 | 249 |
| 245 // Implement the content::NotificationObserver interface. | 250 // Implement the content::NotificationObserver interface. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 309 |
| 305 // The Notification registrar. | 310 // The Notification registrar. |
| 306 content::NotificationRegistrar registrar_; | 311 content::NotificationRegistrar registrar_; |
| 307 | 312 |
| 308 // The accelerator group used to handle accelerators, owned by this object. | 313 // The accelerator group used to handle accelerators, owned by this object. |
| 309 GtkAccelGroup* accel_group_; | 314 GtkAccelGroup* accel_group_; |
| 310 | 315 |
| 311 // The keybinding accelerator registered to show the page action popup. | 316 // The keybinding accelerator registered to show the page action popup. |
| 312 scoped_ptr<ui::AcceleratorGtk> keybinding_; | 317 scoped_ptr<ui::AcceleratorGtk> keybinding_; |
| 313 | 318 |
| 319 // This is used for post-install visual feedback. The page_action icon |
| 320 // is briefly shown even if it hasn't been enabled by its extension. |
| 321 bool preview_enabled_; |
| 322 |
| 314 // The context menu view and model for this extension action. | 323 // The context menu view and model for this extension action. |
| 315 scoped_ptr<MenuGtk> context_menu_; | 324 scoped_ptr<MenuGtk> context_menu_; |
| 316 scoped_refptr<ExtensionContextMenuModel> context_menu_model_; | 325 scoped_refptr<ExtensionContextMenuModel> context_menu_model_; |
| 317 | 326 |
| 318 DISALLOW_COPY_AND_ASSIGN(PageActionViewGtk); | 327 DISALLOW_COPY_AND_ASSIGN(PageActionViewGtk); |
| 319 }; | 328 }; |
| 320 friend class PageActionViewGtk; | 329 friend class PageActionViewGtk; |
| 321 | 330 |
| 322 // Creates, initializes, and packs the location icon, EV certificate name, | 331 // Creates, initializes, and packs the location icon, EV certificate name, |
| 323 // and optional border. | 332 // and optional border. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 486 |
| 478 // Indicate if |tab_to_search_hint_| should be shown. | 487 // Indicate if |tab_to_search_hint_| should be shown. |
| 479 bool show_keyword_hint_; | 488 bool show_keyword_hint_; |
| 480 | 489 |
| 481 // The last search keyword that was shown via the |tab_to_search_box_|. | 490 // The last search keyword that was shown via the |tab_to_search_box_|. |
| 482 string16 last_keyword_; | 491 string16 last_keyword_; |
| 483 | 492 |
| 484 // Used to change the visibility of the star decoration. | 493 // Used to change the visibility of the star decoration. |
| 485 BooleanPrefMember edit_bookmarks_enabled_; | 494 BooleanPrefMember edit_bookmarks_enabled_; |
| 486 | 495 |
| 487 // The extension actions which have "preview enabled". | |
| 488 std::set<ExtensionAction*> preview_enabled_actions_; | |
| 489 | |
| 490 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); | 496 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); |
| 491 }; | 497 }; |
| 492 | 498 |
| 493 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ | 499 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ |
| OLD | NEW |