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