| 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 <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "chrome/browser/command_updater.h" | 19 #include "chrome/browser/command_updater.h" |
| 20 #include "chrome/browser/extensions/extension_context_menu_model.h" | 20 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 21 #include "chrome/browser/extensions/image_loading_tracker.h" | 21 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 22 #include "chrome/browser/prefs/pref_member.h" | 22 #include "chrome/browser/prefs/pref_member.h" |
| 23 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 23 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 24 #include "chrome/browser/ui/gtk/menu_gtk.h" | 24 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 25 #include "chrome/browser/ui/omnibox/location_bar.h" | 25 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 26 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 26 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
| 27 #include "chrome/browser/ui/view_ids.h" | 27 #include "chrome/browser/ui/view_ids.h" |
| 28 #include "chrome/browser/ui/zoom/zoom_controller.h" | 28 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 29 #include "chrome/common/content_settings_types.h" | 29 #include "chrome/common/content_settings_types.h" |
| 30 #include "chrome/common/extensions/extension_action.h" |
| 30 #include "content/public/browser/notification_observer.h" | 31 #include "content/public/browser/notification_observer.h" |
| 31 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
| 32 #include "content/public/common/page_transition_types.h" | 33 #include "content/public/common/page_transition_types.h" |
| 33 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
| 34 #include "third_party/skia/include/core/SkBitmap.h" | 35 #include "third_party/skia/include/core/SkBitmap.h" |
| 35 #include "ui/base/animation/animation_delegate.h" | 36 #include "ui/base/animation/animation_delegate.h" |
| 36 #include "ui/base/animation/slide_animation.h" | 37 #include "ui/base/animation/slide_animation.h" |
| 37 #include "ui/base/gtk/gtk_signal.h" | 38 #include "ui/base/gtk/gtk_signal.h" |
| 38 #include "ui/base/gtk/owned_widget_gtk.h" | 39 #include "ui/base/gtk/owned_widget_gtk.h" |
| 39 #include "webkit/glue/window_open_disposition.h" | 40 #include "webkit/glue/window_open_disposition.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 ui::SlideAnimation animation_; | 224 ui::SlideAnimation animation_; |
| 224 | 225 |
| 225 // The label's default requisition (cached so we can animate accordingly). | 226 // The label's default requisition (cached so we can animate accordingly). |
| 226 GtkRequisition label_req_; | 227 GtkRequisition label_req_; |
| 227 | 228 |
| 228 base::WeakPtrFactory<ContentSettingImageViewGtk> weak_factory_; | 229 base::WeakPtrFactory<ContentSettingImageViewGtk> weak_factory_; |
| 229 | 230 |
| 230 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk); | 231 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk); |
| 231 }; | 232 }; |
| 232 | 233 |
| 233 class PageActionViewGtk : public ImageLoadingTracker::Observer, | 234 class PageActionViewGtk : |
| 234 public content::NotificationObserver, | 235 public ImageLoadingTracker::Observer, |
| 235 public ExtensionContextMenuModel::PopupDelegate { | 236 public content::NotificationObserver, |
| 237 public ExtensionContextMenuModel::PopupDelegate, |
| 238 public ExtensionAction::IconAnimation::Observer { |
| 236 public: | 239 public: |
| 237 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); | 240 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); |
| 238 virtual ~PageActionViewGtk(); | 241 virtual ~PageActionViewGtk(); |
| 239 | 242 |
| 240 GtkWidget* widget() { return event_box_.get(); } | 243 GtkWidget* widget() { return event_box_.get(); } |
| 241 | 244 |
| 242 ExtensionAction* page_action() { return page_action_; } | 245 ExtensionAction* page_action() { return page_action_; } |
| 243 | 246 |
| 244 void set_preview_enabled(bool preview_enabled) { | 247 void set_preview_enabled(bool preview_enabled) { |
| 245 preview_enabled_ = preview_enabled; | 248 preview_enabled_ = preview_enabled; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 CHROMEGTK_CALLBACK_0(PageActionViewGtk, void, OnRealize); | 285 CHROMEGTK_CALLBACK_0(PageActionViewGtk, void, OnRealize); |
| 283 | 286 |
| 284 // The accelerator handler for when the shortcuts to open the popup is | 287 // The accelerator handler for when the shortcuts to open the popup is |
| 285 // struck. | 288 // struck. |
| 286 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, | 289 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group, |
| 287 GObject* acceleratable, | 290 GObject* acceleratable, |
| 288 guint keyval, | 291 guint keyval, |
| 289 GdkModifierType modifier, | 292 GdkModifierType modifier, |
| 290 void* user_data); | 293 void* user_data); |
| 291 | 294 |
| 295 // ExtensionAction::IconAnimationDelegate implementation. |
| 296 virtual void OnIconChanged( |
| 297 const ExtensionAction::IconAnimation& animation) OVERRIDE; |
| 298 |
| 292 // The location bar view that owns us. | 299 // The location bar view that owns us. |
| 293 LocationBarViewGtk* owner_; | 300 LocationBarViewGtk* owner_; |
| 294 | 301 |
| 295 // The PageAction that this view represents. The PageAction is not owned by | 302 // The PageAction that this view represents. The PageAction is not owned by |
| 296 // us, it resides in the extension of this particular profile. | 303 // us, it resides in the extension of this particular profile. |
| 297 ExtensionAction* page_action_; | 304 ExtensionAction* page_action_; |
| 298 | 305 |
| 299 // A cache of all the different icon paths associated with this page action. | 306 // A cache of all the different icon paths associated with this page action. |
| 300 typedef std::map<std::string, GdkPixbuf*> PixbufMap; | 307 typedef std::map<std::string, GdkPixbuf*> PixbufMap; |
| 301 PixbufMap pixbufs_; | 308 PixbufMap pixbufs_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 scoped_ptr<ui::AcceleratorGtk> keybinding_; | 340 scoped_ptr<ui::AcceleratorGtk> keybinding_; |
| 334 | 341 |
| 335 // This is used for post-install visual feedback. The page_action icon | 342 // This is used for post-install visual feedback. The page_action icon |
| 336 // is briefly shown even if it hasn't been enabled by its extension. | 343 // is briefly shown even if it hasn't been enabled by its extension. |
| 337 bool preview_enabled_; | 344 bool preview_enabled_; |
| 338 | 345 |
| 339 // The context menu view and model for this extension action. | 346 // The context menu view and model for this extension action. |
| 340 scoped_ptr<MenuGtk> context_menu_; | 347 scoped_ptr<MenuGtk> context_menu_; |
| 341 scoped_refptr<ExtensionContextMenuModel> context_menu_model_; | 348 scoped_refptr<ExtensionContextMenuModel> context_menu_model_; |
| 342 | 349 |
| 350 // Weak reference to the fade-in animation for the icon. |
| 351 base::WeakPtr<ExtensionAction::IconAnimation> icon_animation_; |
| 352 |
| 343 DISALLOW_COPY_AND_ASSIGN(PageActionViewGtk); | 353 DISALLOW_COPY_AND_ASSIGN(PageActionViewGtk); |
| 344 }; | 354 }; |
| 345 friend class PageActionViewGtk; | 355 friend class PageActionViewGtk; |
| 346 | 356 |
| 347 // Creates, initializes, and packs the location icon, EV certificate name, | 357 // Creates, initializes, and packs the location icon, EV certificate name, |
| 348 // and optional border. | 358 // and optional border. |
| 349 void BuildSiteTypeArea(); | 359 void BuildSiteTypeArea(); |
| 350 | 360 |
| 351 // Enable or disable the location icon/EV certificate as a drag source for | 361 // Enable or disable the location icon/EV certificate as a drag source for |
| 352 // the URL. | 362 // the URL. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 // The last search keyword that was shown via the |tab_to_search_box_|. | 535 // The last search keyword that was shown via the |tab_to_search_box_|. |
| 526 string16 last_keyword_; | 536 string16 last_keyword_; |
| 527 | 537 |
| 528 // Used to change the visibility of the star decoration. | 538 // Used to change the visibility of the star decoration. |
| 529 BooleanPrefMember edit_bookmarks_enabled_; | 539 BooleanPrefMember edit_bookmarks_enabled_; |
| 530 | 540 |
| 531 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); | 541 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); |
| 532 }; | 542 }; |
| 533 | 543 |
| 534 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ | 544 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ |
| OLD | NEW |