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

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

Issue 2862025: Canvas refactoring part 2.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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/extensions/extension_context_menu_model.h" 9 #include "chrome/browser/extensions/extension_context_menu_model.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 16 matching lines...) Expand all
27 menu_button_(menu_button), 27 menu_button_(menu_button),
28 views_(&views), 28 views_(&views),
29 start_index_(start_index), 29 start_index_(start_index),
30 for_drop_(false) { 30 for_drop_(false) {
31 menu_.reset(new views::MenuItemView(this)); 31 menu_.reset(new views::MenuItemView(this));
32 menu_->set_has_icons(true); 32 menu_->set_has_icons(true);
33 33
34 size_t command_id = 1; // Menu id 0 is reserved, start with 1. 34 size_t command_id = 1; // Menu id 0 is reserved, start with 1.
35 for (size_t i = start_index; i < views_->size(); ++i) { 35 for (size_t i = start_index; i < views_->size(); ++i) {
36 BrowserActionView* view = (*views_)[i]; 36 BrowserActionView* view = (*views_)[i];
37 scoped_ptr<gfx::Canvas> canvas(view->GetIconWithBadge()); 37 scoped_ptr<gfx::CanvasSkia> canvas(view->GetIconWithBadge());
38 menu_->AppendMenuItemWithIcon( 38 menu_->AppendMenuItemWithIcon(
39 command_id, 39 command_id,
40 UTF8ToWide(view->button()->extension()->name()), 40 UTF8ToWide(view->button()->extension()->name()),
41 canvas->ExtractBitmap()); 41 canvas->ExtractBitmap());
42 42
43 // Set the tooltip for this item. 43 // Set the tooltip for this item.
44 std::wstring tooltip = UTF8ToWide( 44 std::wstring tooltip = UTF8ToWide(
45 view->button()->extension()->browser_action()->GetTitle( 45 view->button()->extension()->browser_action()->GetTitle(
46 owner_->GetCurrentTabId())); 46 owner_->GetCurrentTabId()));
47 menu_->SetTooltip(tooltip, command_id); 47 menu_->SetTooltip(tooltip, command_id);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( 201 BrowserActionView* BrowserActionOverflowMenuController::ViewForId(
202 int id, size_t* index) { 202 int id, size_t* index) {
203 // The index of the view being dragged (GetCommand gives a 1-based index into 203 // The index of the view being dragged (GetCommand gives a 1-based index into
204 // the overflow menu). 204 // the overflow menu).
205 size_t view_index = owner_->VisibleBrowserActions() + id - 1; 205 size_t view_index = owner_->VisibleBrowserActions() + id - 1;
206 if (index) 206 if (index)
207 *index = view_index; 207 *index = view_index;
208 return owner_->GetBrowserActionViewAt(view_index); 208 return owner_->GetBrowserActionViewAt(view_index);
209 } 209 }
OLDNEW
« no previous file with comments | « chrome/browser/views/browser_actions_container.cc ('k') | chrome/browser/views/infobars/extension_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698