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

Side by Side Diff: chrome/browser/ui/views/toolbar/chevron_menu_button.cc

Issue 888043003: [Extensions Toolbar Views] Add a ToolbarActionView unittest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/toolbar/chevron_menu_button.h" 5 #include "chrome/browser/ui/views/toolbar/chevron_menu_button.h"
6 6
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_action.h" 10 #include "chrome/browser/extensions/extension_action.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 ui::MenuSourceType source_type) { 226 ui::MenuSourceType source_type) {
227 ToolbarActionView* view = browser_actions_container_->GetToolbarActionViewAt( 227 ToolbarActionView* view = browser_actions_container_->GetToolbarActionViewAt(
228 start_index_ + id - 1); 228 start_index_ + id - 1);
229 ExtensionActionViewController* view_controller = 229 ExtensionActionViewController* view_controller =
230 static_cast<ExtensionActionViewController*>(view->view_controller()); 230 static_cast<ExtensionActionViewController*>(view->view_controller());
231 if (!view_controller->extension()->ShowConfigureContextMenus()) 231 if (!view_controller->extension()->ShowConfigureContextMenus())
232 return false; 232 return false;
233 233
234 scoped_refptr<ExtensionContextMenuModel> context_menu_contents = 234 scoped_refptr<ExtensionContextMenuModel> context_menu_contents =
235 new ExtensionContextMenuModel(view_controller->extension(), 235 new ExtensionContextMenuModel(view_controller->extension(),
236 view->browser(), 236 view_controller->browser(),
237 view_controller); 237 view_controller);
238 views::MenuRunner context_menu_runner(context_menu_contents.get(), 238 views::MenuRunner context_menu_runner(context_menu_contents.get(),
239 views::MenuRunner::HAS_MNEMONICS | 239 views::MenuRunner::HAS_MNEMONICS |
240 views::MenuRunner::IS_NESTED | 240 views::MenuRunner::IS_NESTED |
241 views::MenuRunner::CONTEXT_MENU); 241 views::MenuRunner::CONTEXT_MENU);
242 242
243 // We can ignore the result as we delete ourself. 243 // We can ignore the result as we delete ourself.
244 // This blocks until the user chooses something or dismisses the menu. 244 // This blocks until the user chooses something or dismisses the menu.
245 if (context_menu_runner.RunMenuAt(owner_->GetWidget(), 245 if (context_menu_runner.RunMenuAt(owner_->GetWidget(),
246 NULL, 246 NULL,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // We should never try to show an overflow menu when one is already visible. 432 // We should never try to show an overflow menu when one is already visible.
433 DCHECK(!menu_controller_); 433 DCHECK(!menu_controller_);
434 menu_controller_.reset(new MenuController( 434 menu_controller_.reset(new MenuController(
435 this, browser_actions_container_, for_drop)); 435 this, browser_actions_container_, for_drop));
436 menu_controller_->RunMenu(GetWidget()); 436 menu_controller_->RunMenu(GetWidget());
437 } 437 }
438 438
439 void ChevronMenuButton::MenuDone() { 439 void ChevronMenuButton::MenuDone() {
440 menu_controller_.reset(); 440 menu_controller_.reset();
441 } 441 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/browser_actions_container.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_action_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698