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

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

Issue 9705097: Revert 127146 - Add Extension Keybinding test for page actions and port the PageAction keybindings … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
Property Changes:
Deleted: svn:mergeinfo
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 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
(...skipping 30 matching lines...) Expand all
41 class ContentSettingBubbleGtk; 41 class ContentSettingBubbleGtk;
42 class ExtensionAction; 42 class ExtensionAction;
43 class ThemeServiceGtk; 43 class ThemeServiceGtk;
44 class SkBitmap; 44 class SkBitmap;
45 class ToolbarModel; 45 class ToolbarModel;
46 46
47 namespace content { 47 namespace content {
48 class WebContents; 48 class WebContents;
49 } 49 }
50 50
51 namespace ui {
52 class AcceleratorGtk;
53 }
54
55 class LocationBarViewGtk : public AutocompleteEditController, 51 class LocationBarViewGtk : public AutocompleteEditController,
56 public LocationBar, 52 public LocationBar,
57 public LocationBarTesting, 53 public LocationBarTesting,
58 public content::NotificationObserver { 54 public content::NotificationObserver {
59 public: 55 public:
60 explicit LocationBarViewGtk(Browser* browser); 56 explicit LocationBarViewGtk(Browser* browser);
61 virtual ~LocationBarViewGtk(); 57 virtual ~LocationBarViewGtk();
62 58
63 void Init(bool popup_window_mode); 59 void Init(bool popup_window_mode);
64 60
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 200
205 // The label's default requisition (cached so we can animate accordingly). 201 // The label's default requisition (cached so we can animate accordingly).
206 GtkRequisition label_req_; 202 GtkRequisition label_req_;
207 203
208 base::WeakPtrFactory<ContentSettingImageViewGtk> weak_factory_; 204 base::WeakPtrFactory<ContentSettingImageViewGtk> weak_factory_;
209 205
210 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk); 206 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageViewGtk);
211 }; 207 };
212 208
213 class PageActionViewGtk : public ImageLoadingTracker::Observer, 209 class PageActionViewGtk : public ImageLoadingTracker::Observer,
214 public content::NotificationObserver,
215 public ExtensionContextMenuModel::PopupDelegate { 210 public ExtensionContextMenuModel::PopupDelegate {
216 public: 211 public:
217 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action); 212 PageActionViewGtk(LocationBarViewGtk* owner, ExtensionAction* page_action);
218 virtual ~PageActionViewGtk(); 213 virtual ~PageActionViewGtk();
219 214
220 GtkWidget* widget() { return event_box_.get(); } 215 GtkWidget* widget() { return event_box_.get(); }
221 216
222 ExtensionAction* page_action() { return page_action_; } 217 ExtensionAction* page_action() { return page_action_; }
223 218
224 void set_preview_enabled(bool preview_enabled) { 219 void set_preview_enabled(bool preview_enabled) {
225 preview_enabled_ = preview_enabled; 220 preview_enabled_ = preview_enabled;
226 } 221 }
227 222
228 bool IsVisible(); 223 bool IsVisible();
229 224
230 // Called to notify the PageAction that it should determine whether to be 225 // Called to notify the PageAction that it should determine whether to be
231 // visible or hidden. |contents| is the TabContents that is active, |url| 226 // visible or hidden. |contents| is the TabContents that is active, |url|
232 // is the current page URL. 227 // is the current page URL.
233 void UpdateVisibility(content::WebContents* contents, const GURL& url); 228 void UpdateVisibility(content::WebContents* contents, const GURL& url);
234 229
235 // A callback from ImageLoadingTracker for when the image has loaded. 230 // A callback from ImageLoadingTracker for when the image has loaded.
236 virtual void OnImageLoaded(const gfx::Image& image, 231 virtual void OnImageLoaded(const gfx::Image& image,
237 const std::string& extension_id, 232 const std::string& extension_id,
238 int index) OVERRIDE; 233 int index) OVERRIDE;
239 234
240 // Simulate left mouse click on the page action button. 235 // Simulate left mouse click on the page action button.
241 void TestActivatePageAction(); 236 void TestActivatePageAction();
242 237
243 // Implement the content::NotificationObserver interface.
244 virtual void Observe(int type,
245 const content::NotificationSource& source,
246 const content::NotificationDetails& details) OVERRIDE;
247
248 // Overridden from ExtensionContextMenuModel::PopupDelegate: 238 // Overridden from ExtensionContextMenuModel::PopupDelegate:
249 virtual void InspectPopup(ExtensionAction* action) OVERRIDE; 239 virtual void InspectPopup(ExtensionAction* action) OVERRIDE;
250 240
251 private: 241 private:
252 // Show the popup for this page action. If |devtools| is true, show it 242 // Show the popup for this page action. If |devtools| is true, show it
253 // with a debugger window attached. Returns true if a popup was shown. 243 // with a debugger window attached. Returns true if a popup was shown.
254 bool ShowPopup(bool devtools); 244 bool ShowPopup(bool devtools);
255 245
256 // Connect the accelerator for the page action popup.
257 void ConnectPageActionAccelerator();
258
259 // Disconnect the accelerator for the page action popup.
260 void DisconnectPageActionAccelerator();
261
262 CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnButtonPressed, 246 CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnButtonPressed,
263 GdkEventButton*); 247 GdkEventButton*);
264 CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnExposeEvent, 248 CHROMEGTK_CALLBACK_1(PageActionViewGtk, gboolean, OnExposeEvent,
265 GdkEventExpose*); 249 GdkEventExpose*);
266 CHROMEGTK_CALLBACK_0(PageActionViewGtk, void, OnRealize);
267
268 // The accelerator handler for when the shortcuts to open the popup is
269 // struck.
270 static gboolean OnGtkAccelerator(GtkAccelGroup* accel_group,
271 GObject* acceleratable,
272 guint keyval,
273 GdkModifierType modifier,
274 void* user_data);
275 250
276 // The location bar view that owns us. 251 // The location bar view that owns us.
277 LocationBarViewGtk* owner_; 252 LocationBarViewGtk* owner_;
278 253
279 // The PageAction that this view represents. The PageAction is not owned by 254 // The PageAction that this view represents. The PageAction is not owned by
280 // us, it resides in the extension of this particular profile. 255 // us, it resides in the extension of this particular profile.
281 ExtensionAction* page_action_; 256 ExtensionAction* page_action_;
282 257
283 // A cache of all the different icon paths associated with this page action. 258 // A cache of all the different icon paths associated with this page action.
284 typedef std::map<std::string, GdkPixbuf*> PixbufMap; 259 typedef std::map<std::string, GdkPixbuf*> PixbufMap;
(...skipping 12 matching lines...) Expand all
297 // The widgets for this page action. 272 // The widgets for this page action.
298 ui::OwnedWidgetGtk event_box_; 273 ui::OwnedWidgetGtk event_box_;
299 ui::OwnedWidgetGtk image_; 274 ui::OwnedWidgetGtk image_;
300 275
301 // The tab id we are currently showing the icon for. 276 // The tab id we are currently showing the icon for.
302 int current_tab_id_; 277 int current_tab_id_;
303 278
304 // The URL we are currently showing the icon for. 279 // The URL we are currently showing the icon for.
305 GURL current_url_; 280 GURL current_url_;
306 281
307 // The native browser window of the location bar that owns us.
308 gfx::NativeWindow window_;
309
310 // The Notification registrar.
311 content::NotificationRegistrar registrar_;
312
313 // The accelerator group used to handle accelerators, owned by this object.
314 GtkAccelGroup* accel_group_;
315
316 // The keybinding accelerator registered to show the page action popup.
317 scoped_ptr<ui::AcceleratorGtk> keybinding_;
318
319 // This is used for post-install visual feedback. The page_action icon 282 // 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. 283 // is briefly shown even if it hasn't been enabled by its extension.
321 bool preview_enabled_; 284 bool preview_enabled_;
322 285
323 // The context menu view and model for this extension action. 286 // The context menu view and model for this extension action.
324 scoped_ptr<MenuGtk> context_menu_; 287 scoped_ptr<MenuGtk> context_menu_;
325 scoped_refptr<ExtensionContextMenuModel> context_menu_model_; 288 scoped_refptr<ExtensionContextMenuModel> context_menu_model_;
326 289
327 DISALLOW_COPY_AND_ASSIGN(PageActionViewGtk); 290 DISALLOW_COPY_AND_ASSIGN(PageActionViewGtk);
328 }; 291 };
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // The last search keyword that was shown via the |tab_to_search_box_|. 443 // The last search keyword that was shown via the |tab_to_search_box_|.
481 string16 last_keyword_; 444 string16 last_keyword_;
482 445
483 // Used to change the visibility of the star decoration. 446 // Used to change the visibility of the star decoration.
484 BooleanPrefMember edit_bookmarks_enabled_; 447 BooleanPrefMember edit_bookmarks_enabled_;
485 448
486 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); 449 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk);
487 }; 450 };
488 451
489 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_ 452 #endif // CHROME_BROWSER_UI_GTK_LOCATION_BAR_VIEW_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_apitest.cc ('k') | chrome/browser/ui/gtk/location_bar_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698