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

Side by Side Diff: chrome/browser/ui/views/location_bar/action_box_button_view.cc

Issue 10533086: Action box menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Action box menu Created 8 years, 4 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 #include "chrome/browser/ui/views/location_bar/action_box_button_view.h" 5 #include "chrome/browser/ui/views/location_bar/action_box_button_view.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/command_updater.h" 9 #include "chrome/browser/command_updater.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_system.h"
12 #include "chrome/browser/ui/toolbar/action_box_menu_model.h"
11 #include "chrome/browser/ui/view_ids.h" 13 #include "chrome/browser/ui/view_ids.h"
14 #include "chrome/browser/ui/views/action_box_menu.h"
12 #include "chrome/browser/ui/views/browser_dialogs.h" 15 #include "chrome/browser/ui/views/browser_dialogs.h"
13 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
14 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
15 #include "ui/base/accessibility/accessible_view_state.h" 18 #include "ui/base/accessibility/accessible_view_state.h"
16 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
18 21
19 namespace { 22 namespace {
20 23
21 // Colors used for button backgrounds. 24 // Colors used for button backgrounds.
22 const SkColor kNormalBackgroundColor = SkColorSetRGB(255, 255, 255); 25 const SkColor kNormalBackgroundColor = SkColorSetRGB(255, 255, 255);
23 const SkColor kHotBackgroundColor = SkColorSetRGB(239, 239, 239); 26 const SkColor kHotBackgroundColor = SkColorSetRGB(239, 239, 239);
24 const SkColor kPushedBackgroundColor = SkColorSetRGB(207, 207, 207); 27 const SkColor kPushedBackgroundColor = SkColorSetRGB(207, 207, 207);
25 28
26 const SkColor kNormalBorderColor = SkColorSetRGB(255, 255, 255); 29 const SkColor kNormalBorderColor = SkColorSetRGB(255, 255, 255);
27 const SkColor kHotBorderColor = SkColorSetRGB(223, 223, 223); 30 const SkColor kHotBorderColor = SkColorSetRGB(223, 223, 223);
28 const SkColor kPushedBorderColor = SkColorSetRGB(191, 191, 191); 31 const SkColor kPushedBorderColor = SkColorSetRGB(191, 191, 191);
29 32
30 } // namespace 33 } // namespace
31 34
32 35
33 ActionBoxButtonView::ActionBoxButtonView(ExtensionService* extension_service) 36 ActionBoxButtonView::ActionBoxButtonView(Browser* browser, Profile* profile)
34 : views::MenuButton(NULL, string16(), this, false), 37 : views::MenuButton(NULL, string16(), this, false),
35 extension_service_(extension_service) { 38 browser_(browser),
39 profile_(profile),
40 starred_(false) {
36 set_id(VIEW_ID_ACTION_BOX_BUTTON); 41 set_id(VIEW_ID_ACTION_BOX_BUTTON);
37 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_ACTION_BOX_BUTTON)); 42 SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_ACTION_BOX_BUTTON));
38 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetBitmapNamed( 43 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetBitmapNamed(
39 IDR_ACTION_BOX_BUTTON)); 44 IDR_ACTION_BOX_BUTTON));
40 set_accessibility_focusable(true); 45 set_accessibility_focusable(true);
41 set_border(NULL); 46 set_border(NULL);
42 } 47 }
43 48
44 ActionBoxButtonView::~ActionBoxButtonView() { 49 ActionBoxButtonView::~ActionBoxButtonView() {
45 } 50 }
(...skipping 20 matching lines...) Expand all
66 } 71 }
67 } 72 }
68 73
69 void ActionBoxButtonView::GetAccessibleState(ui::AccessibleViewState* state) { 74 void ActionBoxButtonView::GetAccessibleState(ui::AccessibleViewState* state) {
70 MenuButton::GetAccessibleState(state); 75 MenuButton::GetAccessibleState(state);
71 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_ACTION_BOX_BUTTON); 76 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_ACTION_BOX_BUTTON);
72 } 77 }
73 78
74 void ActionBoxButtonView::OnMenuButtonClicked(View* source, 79 void ActionBoxButtonView::OnMenuButtonClicked(View* source,
75 const gfx::Point& point) { 80 const gfx::Point& point) {
76 // TODO(yefim): Implement menu here. 81 ExtensionService* extension_service =
82 extensions::ExtensionSystem::Get(profile_)->extension_service();
83
84 ActionBoxMenuModel model(extension_service);
85 ActionBoxMenu action_box_menu(browser_, &model, starred_);
86 action_box_menu.Init();
87 action_box_menu.RunMenu(this);
77 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698