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

Side by Side Diff: chrome/browser/ui/gtk/location_bar_view_gtk.h

Issue 10905005: Change browser/page action default icon defined in manifest to support hidpi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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 | Annotate | Revision Log
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_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>
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "chrome/browser/api/prefs/pref_member.h" 18 #include "chrome/browser/api/prefs/pref_member.h"
19 #include "chrome/browser/command_observer.h" 19 #include "chrome/browser/command_observer.h"
20 #include "chrome/browser/extensions/extension_action_icon_factory.h"
20 #include "chrome/browser/extensions/extension_context_menu_model.h" 21 #include "chrome/browser/extensions/extension_context_menu_model.h"
21 #include "chrome/browser/extensions/image_loading_tracker.h"
22 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" 22 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h"
23 #include "chrome/browser/ui/gtk/menu_gtk.h" 23 #include "chrome/browser/ui/gtk/menu_gtk.h"
24 #include "chrome/browser/ui/omnibox/location_bar.h" 24 #include "chrome/browser/ui/omnibox/location_bar.h"
25 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" 25 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h"
26 #include "chrome/browser/ui/view_ids.h" 26 #include "chrome/browser/ui/view_ids.h"
27 #include "chrome/common/content_settings_types.h" 27 #include "chrome/common/content_settings_types.h"
28 #include "chrome/common/extensions/extension_action.h" 28 #include "chrome/common/extensions/extension_action.h"
29 #include "content/public/browser/notification_observer.h" 29 #include "content/public/browser/notification_observer.h"
30 #include "content/public/browser/notification_registrar.h" 30 #include "content/public/browser/notification_registrar.h"
31 #include "content/public/common/page_transition_types.h" 31 #include "content/public/common/page_transition_types.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 GtkRequisition label_req_; 223 GtkRequisition label_req_;
224 224
225 base::WeakPtrFactory<PageToolViewGtk> weak_factory_; 225 base::WeakPtrFactory<PageToolViewGtk> weak_factory_;
226 226
227 private: 227 private:
228 DISALLOW_COPY_AND_ASSIGN(PageToolViewGtk); 228 DISALLOW_COPY_AND_ASSIGN(PageToolViewGtk);
229 }; 229 };
230 230
231 private: 231 private:
232 class PageActionViewGtk : 232 class PageActionViewGtk :
233 public ImageLoadingTracker::Observer, 233 public ExtensionActionIconFactory::Observer,
234 public content::NotificationObserver, 234 public content::NotificationObserver,
235 public ExtensionContextMenuModel::PopupDelegate, 235 public ExtensionContextMenuModel::PopupDelegate,
236 public ExtensionAction::IconAnimation::Observer { 236 public ExtensionAction::IconAnimation::Observer {
237 public: 237 public:
238 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); 238 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action);
239 virtual ~PageActionViewGtk(); 239 virtual ~PageActionViewGtk();
240 240
241 GtkWidget* widget() { return event_box_.get(); } 241 GtkWidget* widget() { return event_box_.get(); }
242 242
243 ExtensionAction* page_action() { return page_action_; } 243 ExtensionAction* page_action() { return page_action_; }
244 244
245 void set_preview_enabled(bool preview_enabled) { 245 void set_preview_enabled(bool preview_enabled) {
246 preview_enabled_ = preview_enabled; 246 preview_enabled_ = preview_enabled;
247 } 247 }
248 248
249 bool IsVisible(); 249 bool IsVisible();
250 250
251 // Called to notify the PageAction that it should determine whether to be 251 // Called to notify the PageAction that it should determine whether to be
252 // visible or hidden. |contents| is the WebContents that is active, |url| 252 // visible or hidden. |contents| is the WebContents that is active, |url|
253 // is the current page URL. 253 // is the current page URL.
254 void UpdateVisibility(content::WebContents* contents, const GURL& url); 254 void UpdateVisibility(content::WebContents* contents, const GURL& url);
255 255
256 // A callback from ImageLoadingTracker for when the image has loaded. 256 // Overriden from ExtensionActionIconFactory::Observer.
257 virtual void OnImageLoaded(const gfx::Image& image, 257 virtual void OnIconUpdated() OVERRIDE;
258 const std::string& extension_id,
259 int index) OVERRIDE;
260 258
261 // Simulate left mouse click on the page action button. 259 // Simulate left mouse click on the page action button.
262 void TestActivatePageAction(); 260 void TestActivatePageAction();
263 261
264 // Implement the content::NotificationObserver interface. 262 // Implement the content::NotificationObserver interface.
265 virtual void Observe(int type, 263 virtual void Observe(int type,
266 const content::NotificationSource& source, 264 const content::NotificationSource& source,
267 const content::NotificationDetails& details) OVERRIDE; 265 const content::NotificationDetails& details) OVERRIDE;
268 266
269 // Overridden from ExtensionContextMenuModel::PopupDelegate: 267 // Overridden from ExtensionContextMenuModel::PopupDelegate:
(...skipping 24 matching lines...) Expand all
294 virtual void OnIconChanged( 292 virtual void OnIconChanged(
295 const ExtensionAction::IconAnimation& animation) OVERRIDE; 293 const ExtensionAction::IconAnimation& animation) OVERRIDE;
296 294
297 // The location bar view that owns us. 295 // The location bar view that owns us.
298 LocationBarViewGtk* owner_; 296 LocationBarViewGtk* owner_;
299 297
300 // The PageAction that this view represents. The PageAction is not owned by 298 // The PageAction that this view represents. The PageAction is not owned by
301 // us, it resides in the extension of this particular profile. 299 // us, it resides in the extension of this particular profile.
302 ExtensionAction* page_action_; 300 ExtensionAction* page_action_;
303 301
304 // The object that is waiting for the image loading to complete 302 // The object that page action will use to create icon for us.
305 // asynchronously. 303 // It may load icon asynchronously (in which case initial icon returned by
306 ImageLoadingTracker tracker_; 304 // the action will be blank), so we have to observe it for icon's updates.
305 scoped_ptr<ExtensionActionIconFactory> icon_factory_;
307 306
308 // The widgets for this page action. 307 // The widgets for this page action.
309 ui::OwnedWidgetGtk event_box_; 308 ui::OwnedWidgetGtk event_box_;
310 ui::OwnedWidgetGtk image_; 309 ui::OwnedWidgetGtk image_;
311 310
312 // The tab id we are currently showing the icon for. 311 // The tab id we are currently showing the icon for.
313 int current_tab_id_; 312 int current_tab_id_;
314 313
315 // The URL we are currently showing the icon for. 314 // The URL we are currently showing the icon for.
316 GURL current_url_; 315 GURL current_url_;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 BooleanPrefMember edit_bookmarks_enabled_; 535 BooleanPrefMember edit_bookmarks_enabled_;
537 536
538 // Used to remember the URL and title text when drag&drop has begun. 537 // Used to remember the URL and title text when drag&drop has begun.
539 GURL drag_url_; 538 GURL drag_url_;
540 string16 drag_title_; 539 string16 drag_title_;
541 540
542 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); 541 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk);
543 }; 542 };
544 543
545 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ 544 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698