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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.h

Issue 10699033: Animation the script badges on views. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/location_bar/page_action_image_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/extensions/image_loading_tracker.h" 13 #include "chrome/browser/extensions/image_loading_tracker.h"
14 #include "chrome/browser/ui/views/extensions/extension_popup.h" 14 #include "chrome/browser/ui/views/extensions/extension_popup.h"
15 #include "chrome/common/extensions/extension_action.h"
15 #include "ui/views/controls/image_view.h" 16 #include "ui/views/controls/image_view.h"
16 17
17 class Browser; 18 class Browser;
18 class ExtensionAction;
19 class LocationBarView; 19 class LocationBarView;
20 20
21 namespace content { 21 namespace content {
22 class WebContents; 22 class WebContents;
23 } 23 }
24 namespace views { 24 namespace views {
25 class MenuRunner; 25 class MenuRunner;
26 } 26 }
27 27
28 // PageActionImageView is used by the LocationBarView to display the icon for a 28 // PageActionImageView is used by the LocationBarView to display the icon for a
29 // given PageAction and notify the extension when the icon is clicked. 29 // given PageAction and notify the extension when the icon is clicked.
30 class PageActionImageView : public views::ImageView, 30 class PageActionImageView : public views::ImageView,
31 public ImageLoadingTracker::Observer, 31 public ImageLoadingTracker::Observer,
32 public views::Widget::Observer, 32 public views::Widget::Observer,
33 public content::NotificationObserver { 33 public content::NotificationObserver,
34 public ExtensionAction::IconAnimation::Observer {
34 public: 35 public:
35 PageActionImageView(LocationBarView* owner, 36 PageActionImageView(LocationBarView* owner,
36 ExtensionAction* page_action, 37 ExtensionAction* page_action,
37 Browser* browser); 38 Browser* browser);
38 virtual ~PageActionImageView(); 39 virtual ~PageActionImageView();
39 40
40 ExtensionAction* page_action() { return page_action_; } 41 ExtensionAction* page_action() { return page_action_; }
41 42
42 int current_tab_id() { return current_tab_id_; } 43 int current_tab_id() { return current_tab_id_; }
43 44
(...skipping 28 matching lines...) Expand all
72 73
73 // Called to notify the PageAction that it should determine whether to be 74 // Called to notify the PageAction that it should determine whether to be
74 // visible or hidden. |contents| is the WebContents that is active, |url| is 75 // visible or hidden. |contents| is the WebContents that is active, |url| is
75 // the current page URL. 76 // the current page URL.
76 void UpdateVisibility(content::WebContents* contents, const GURL& url); 77 void UpdateVisibility(content::WebContents* contents, const GURL& url);
77 78
78 // Either notify listeners or show a popup depending on the page action. 79 // Either notify listeners or show a popup depending on the page action.
79 void ExecuteAction(int button); 80 void ExecuteAction(int button);
80 81
81 private: 82 private:
83 // Overridden from ExtensionAction::IconAnimation::Observer.
84 virtual void OnIconChanged(
85 const ExtensionAction::IconAnimation& animation) OVERRIDE;
86
82 // Shows the popup, with the given URL. 87 // Shows the popup, with the given URL.
83 void ShowPopupWithURL(const GURL& popup_url); 88 void ShowPopupWithURL(const GURL& popup_url);
84 89
85 // Hides the active popup, if there is one. 90 // Hides the active popup, if there is one.
86 void HidePopup(); 91 void HidePopup();
87 92
88 // The location bar view that owns us. 93 // The location bar view that owns us.
89 LocationBarView* owner_; 94 LocationBarView* owner_;
90 95
91 // The PageAction that this view represents. The PageAction is not owned by 96 // The PageAction that this view represents. The PageAction is not owned by
(...skipping 28 matching lines...) Expand all
120 ExtensionPopup* popup_; 125 ExtensionPopup* popup_;
121 126
122 content::NotificationRegistrar registrar_; 127 content::NotificationRegistrar registrar_;
123 128
124 // The extension keybinding accelerator this page action is listening for (to 129 // The extension keybinding accelerator this page action is listening for (to
125 // show the popup). 130 // show the popup).
126 scoped_ptr<ui::Accelerator> keybinding_; 131 scoped_ptr<ui::Accelerator> keybinding_;
127 132
128 scoped_ptr<views::MenuRunner> menu_runner_; 133 scoped_ptr<views::MenuRunner> menu_runner_;
129 134
135 // Fade-in animation for the icon with observer scoped to this.
136 ExtensionAction::IconAnimation::ScopedObserver
137 scoped_icon_animation_observer_;
138
130 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); 139 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView);
131 }; 140 };
132 141
133 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ 142 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/location_bar/page_action_image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698