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

Side by Side Diff: chrome/browser/views/extensions/browser_action_overflow_menu_controller.cc

Issue 549224: Support reordering of Browser Actions within the container. Currently does no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/extensions/browser_action_overflow_menu_controlle r.h" 5 #include "chrome/browser/views/extensions/browser_action_overflow_menu_controlle r.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_list.h" 8 #include "chrome/browser/browser_list.h"
9 #include "chrome/browser/tab_contents/tab_contents.h" 9 #include "chrome/browser/tab_contents/tab_contents.h"
10 #include "chrome/browser/views/browser_actions_container.h" 10 #include "chrome/browser/views/browser_actions_container.h"
(...skipping 11 matching lines...) Expand all
22 start_index_(start_index) { 22 start_index_(start_index) {
23 menu_.reset(new views::MenuItemView(this)); 23 menu_.reset(new views::MenuItemView(this));
24 menu_->set_has_icons(true); 24 menu_->set_has_icons(true);
25 25
26 TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents(); 26 TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents();
27 int tab_id = tab->controller().session_id().id(); 27 int tab_id = tab->controller().session_id().id();
28 28
29 size_t command_id = 0; 29 size_t command_id = 0;
30 for (size_t i = start_index; i < views_->size(); ++i) { 30 for (size_t i = start_index; i < views_->size(); ++i) {
31 BrowserActionView* view = (*views_)[i]; 31 BrowserActionView* view = (*views_)[i];
32 SkBitmap icon =
33 view->button()->extension()->browser_action()->GetIcon(tab_id);
34 if (icon.isNull())
35 icon = view->button()->default_icon();
32 menu_->AppendMenuItemWithIcon( 36 menu_->AppendMenuItemWithIcon(
33 command_id, 37 command_id,
34 UTF8ToWide(view->button()->extension()->name()), 38 UTF8ToWide(view->button()->extension()->name()),
35 view->button()->extension()->browser_action()->GetIcon(tab_id)); 39 icon);
36 ++command_id; 40 ++command_id;
37 } 41 }
38 } 42 }
39 43
40 BrowserActionOverflowMenuController::~BrowserActionOverflowMenuController() { 44 BrowserActionOverflowMenuController::~BrowserActionOverflowMenuController() {
41 } 45 }
42 46
43 bool BrowserActionOverflowMenuController::RunMenu(gfx::NativeWindow window) { 47 bool BrowserActionOverflowMenuController::RunMenu(gfx::NativeWindow window) {
44 gfx::Rect bounds = menu_button_->GetBounds( 48 gfx::Rect bounds = menu_button_->GetBounds(
45 views::View::IGNORE_MIRRORING_TRANSFORMATION); 49 views::View::IGNORE_MIRRORING_TRANSFORMATION);
(...skipping 27 matching lines...) Expand all
73 // This blocks until the user choses something or dismisses. 77 // This blocks until the user choses something or dismisses.
74 context_menu_->Run((*views_)[start_index_ + id]->button()->extension(), 78 context_menu_->Run((*views_)[start_index_ + id]->button()->extension(),
75 gfx::Point(x, y)); 79 gfx::Point(x, y));
76 80
77 // The user is done with the context menu, so we can close the underlying 81 // The user is done with the context menu, so we can close the underlying
78 // menu. 82 // menu.
79 menu_->Cancel(); 83 menu_->Cancel();
80 84
81 return true; 85 return true;
82 } 86 }
OLDNEW
« no previous file with comments | « chrome/browser/views/extensions/browser_action_drag_data_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698