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

Side by Side Diff: chrome/browser/ui/views/action_box_menu.cc

Issue 10905296: Adjusted action box menu position relative to omnibox and action box menu button. (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 #include "chrome/browser/ui/views/action_box_menu.h" 5 #include "chrome/browser/ui/views/action_box_menu.h"
6 6
7 #include "chrome/browser/ui/toolbar/action_box_menu_model.h" 7 #include "chrome/browser/ui/toolbar/action_box_menu_model.h"
8 #include "chrome/browser/ui/views/browser_action_view.h" 8 #include "chrome/browser/ui/views/browser_action_view.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
(...skipping 22 matching lines...) Expand all
33 ActionBoxMenu::~ActionBoxMenu() { 33 ActionBoxMenu::~ActionBoxMenu() {
34 } 34 }
35 35
36 void ActionBoxMenu::Init() { 36 void ActionBoxMenu::Init() {
37 DCHECK(!root_); 37 DCHECK(!root_);
38 root_ = new views::MenuItemView(this); 38 root_ = new views::MenuItemView(this);
39 root_->set_has_icons(true); 39 root_->set_has_icons(true);
40 PopulateMenu(); 40 PopulateMenu();
41 } 41 }
42 42
43 void ActionBoxMenu::RunMenu(views::MenuButton* menu_button) { 43 void ActionBoxMenu::RunMenu(views::MenuButton* menu_button,
44 gfx::Point screen_location; 44 gfx::Point menu_offset) {
45 gfx::Point screen_location(menu_offset);
Peter Kasting 2012/09/14 22:50:53 Nit: Omit this line, you're passing by value preci
yefimt 2012/09/14 23:00:56 Done.
45 views::View::ConvertPointToScreen(menu_button, &screen_location); 46 views::View::ConvertPointToScreen(menu_button, &screen_location);
46 menu_runner_.reset(new views::MenuRunner(root_)); 47 menu_runner_.reset(new views::MenuRunner(root_));
47 // Ignore the result since we don't need to handle a deleted menu specially. 48 // Ignore the result since we don't need to handle a deleted menu specially.
48 ignore_result( 49 ignore_result(
49 menu_runner_->RunMenuAt(menu_button->GetWidget(), 50 menu_runner_->RunMenuAt(menu_button->GetWidget(),
50 menu_button, 51 menu_button,
51 gfx::Rect(screen_location, menu_button->size()), 52 gfx::Rect(screen_location, menu_button->size()),
52 views::MenuItemView::TOPRIGHT, 53 views::MenuItemView::TOPRIGHT,
53 views::MenuRunner::HAS_MNEMONICS)); 54 views::MenuRunner::HAS_MNEMONICS));
54 } 55 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const extensions::Extension* extension = 139 const extensions::Extension* extension =
139 model_->GetExtensionAt(model_index); 140 model_->GetExtensionAt(model_index);
140 BrowserActionView* view = new BrowserActionView(extension, 141 BrowserActionView* view = new BrowserActionView(extension,
141 browser_, this); 142 browser_, this);
142 // |menu_item| will own the |view| from now on. 143 // |menu_item| will own the |view| from now on.
143 menu_item->SetIconView(view); 144 menu_item->SetIconView(view);
144 } 145 }
145 } 146 }
146 } 147 }
147 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698