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

Side by Side Diff: chrome/browser/ui/views/browser_actions_container.h

Issue 9402018: Experimental Extension Keybinding (first cut). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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) 2011 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_BROWSER_ACTIONS_CONTAINER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
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/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop_helpers.h" 16 #include "base/message_loop_helpers.h"
17 #include "chrome/browser/extensions/extension_context_menu_model.h" 17 #include "chrome/browser/extensions/extension_context_menu_model.h"
18 #include "chrome/browser/extensions/extension_keybinding_registry.h"
18 #include "chrome/browser/extensions/extension_toolbar_model.h" 19 #include "chrome/browser/extensions/extension_toolbar_model.h"
19 #include "chrome/browser/extensions/image_loading_tracker.h" 20 #include "chrome/browser/extensions/image_loading_tracker.h"
20 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro ller.h" 21 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro ller.h"
21 #include "chrome/browser/ui/views/extensions/extension_popup.h" 22 #include "chrome/browser/ui/views/extensions/extension_popup.h"
22 #include "content/public/browser/notification_observer.h" 23 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 24 #include "content/public/browser/notification_registrar.h"
25 #include "ui/base/accelerators/accelerator.h"
24 #include "ui/base/animation/animation_delegate.h" 26 #include "ui/base/animation/animation_delegate.h"
25 #include "ui/base/animation/tween.h" 27 #include "ui/base/animation/tween.h"
26 #include "ui/views/controls/button/menu_button.h" 28 #include "ui/views/controls/button/menu_button.h"
27 #include "ui/views/controls/menu/view_menu_delegate.h" 29 #include "ui/views/controls/menu/view_menu_delegate.h"
28 #include "ui/views/controls/resize_area_delegate.h" 30 #include "ui/views/controls/resize_area_delegate.h"
29 #include "ui/views/drag_controller.h" 31 #include "ui/views/drag_controller.h"
30 #include "ui/views/view.h" 32 #include "ui/views/view.h"
31 33
32 class Browser; 34 class Browser;
33 class BrowserActionOverflowMenuController; 35 class BrowserActionOverflowMenuController;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // button will stay in the pushed state until the "menu" (a popup in this 99 // button will stay in the pushed state until the "menu" (a popup in this
98 // case) is dismissed. 100 // case) is dismissed.
99 virtual bool Activate() OVERRIDE; 101 virtual bool Activate() OVERRIDE;
100 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; 102 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
101 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; 103 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
102 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; 104 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
103 virtual bool OnKeyReleased(const views::KeyEvent& event) OVERRIDE; 105 virtual bool OnKeyReleased(const views::KeyEvent& event) OVERRIDE;
104 virtual void ShowContextMenu(const gfx::Point& p, 106 virtual void ShowContextMenu(const gfx::Point& p,
105 bool is_mouse_gesture) OVERRIDE; 107 bool is_mouse_gesture) OVERRIDE;
106 108
109 // Overridden from ui::AcceleratorTarget.
110 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
111
107 // Notifications when to set button state to pushed/not pushed (for when the 112 // Notifications when to set button state to pushed/not pushed (for when the
108 // popup/context menu is hidden or shown by the container). 113 // popup/context menu is hidden or shown by the container).
109 void SetButtonPushed(); 114 void SetButtonPushed();
110 void SetButtonNotPushed(); 115 void SetButtonNotPushed();
111 116
112 protected: 117 protected:
113 // Overridden from views::View: 118 // Overridden from views::View:
114 virtual void ViewHierarchyChanged(bool is_add, 119 virtual void ViewHierarchyChanged(bool is_add,
115 View* parent, 120 View* parent,
116 View* child) OVERRIDE; 121 View* child) OVERRIDE;
(...skipping 17 matching lines...) Expand all
134 SkBitmap default_icon_; 139 SkBitmap default_icon_;
135 140
136 // The browser action shelf. 141 // The browser action shelf.
137 BrowserActionsContainer* panel_; 142 BrowserActionsContainer* panel_;
138 143
139 // The context menu. This member is non-NULL only when the menu is shown. 144 // The context menu. This member is non-NULL only when the menu is shown.
140 views::MenuItemView* context_menu_; 145 views::MenuItemView* context_menu_;
141 146
142 content::NotificationRegistrar registrar_; 147 content::NotificationRegistrar registrar_;
143 148
149 // The extension keybinding accelerator this browser action is listening for
150 // (to show the popup).
151 scoped_ptr<ui::Accelerator> keybinding_;
152
144 friend class base::DeleteHelper<BrowserActionButton>; 153 friend class base::DeleteHelper<BrowserActionButton>;
145 154
146 DISALLOW_COPY_AND_ASSIGN(BrowserActionButton); 155 DISALLOW_COPY_AND_ASSIGN(BrowserActionButton);
147 }; 156 };
148 157
149 158
150 //////////////////////////////////////////////////////////////////////////////// 159 ////////////////////////////////////////////////////////////////////////////////
151 // BrowserActionView 160 // BrowserActionView
152 // A single section in the browser action container. This contains the actual 161 // A single section in the browser action container. This contains the actual
153 // BrowserActionButton, as well as the logic to paint the badge. 162 // BrowserActionButton, as well as the logic to paint the badge.
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // The resize area for the container. 497 // The resize area for the container.
489 views::ResizeArea* resize_area_; 498 views::ResizeArea* resize_area_;
490 499
491 // The chevron for accessing the overflow items. 500 // The chevron for accessing the overflow items.
492 views::MenuButton* chevron_; 501 views::MenuButton* chevron_;
493 502
494 // The menu to show for the overflow button (chevron). This class manages its 503 // The menu to show for the overflow button (chevron). This class manages its
495 // own lifetime so that it can stay alive during drag and drop operations. 504 // own lifetime so that it can stay alive during drag and drop operations.
496 BrowserActionOverflowMenuController* overflow_menu_; 505 BrowserActionOverflowMenuController* overflow_menu_;
497 506
507 // The class that registers for keyboard shortcuts for extension commands.
508 ExtensionKeybindingRegistry extension_keybinding_registry_;
509
498 // The animation that happens when the container snaps to place. 510 // The animation that happens when the container snaps to place.
499 scoped_ptr<ui::SlideAnimation> resize_animation_; 511 scoped_ptr<ui::SlideAnimation> resize_animation_;
500 512
501 // Don't show the chevron while animating. 513 // Don't show the chevron while animating.
502 bool suppress_chevron_; 514 bool suppress_chevron_;
503 515
504 // This is used while the user is resizing (and when the animations are in 516 // This is used while the user is resizing (and when the animations are in
505 // progress) to know how wide the delta is between the current state and what 517 // progress) to know how wide the delta is between the current state and what
506 // we should draw. 518 // we should draw.
507 int resize_amount_; 519 int resize_amount_;
508 520
509 // Keeps track of the absolute pixel width the container should have when we 521 // Keeps track of the absolute pixel width the container should have when we
510 // are done animating. 522 // are done animating.
511 int animation_target_size_; 523 int animation_target_size_;
512 524
513 // The x position for where to draw the drop indicator. -1 if no indicator. 525 // The x position for where to draw the drop indicator. -1 if no indicator.
514 int drop_indicator_position_; 526 int drop_indicator_position_;
515 527
516 base::WeakPtrFactory<BrowserActionsContainer> task_factory_; 528 base::WeakPtrFactory<BrowserActionsContainer> task_factory_;
517 529
518 // Handles delayed showing of the overflow menu when hovering. 530 // Handles delayed showing of the overflow menu when hovering.
519 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; 531 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_;
520 532
521 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 533 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
522 }; 534 };
523 535
524 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 536 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/ui/views/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698