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

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

Issue 431473003: Make all views platforms use 'new' (cros-style) wrench menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile errors Created 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 338
339 void ToolbarView::ShowBrowserActionPopup( 339 void ToolbarView::ShowBrowserActionPopup(
340 const extensions::Extension* extension) { 340 const extensions::Extension* extension) {
341 browser_actions_->ShowPopupForExtension(extension, true, false); 341 browser_actions_->ShowPopupForExtension(extension, true, false);
342 } 342 }
343 343
344 void ToolbarView::ShowAppMenu(bool for_drop) { 344 void ToolbarView::ShowAppMenu(bool for_drop) {
345 if (wrench_menu_.get() && wrench_menu_->IsShowing()) 345 if (wrench_menu_.get() && wrench_menu_->IsShowing())
346 return; 346 return;
347 347
348 int run_flags = 0;
349 bool use_new_menu = false;
350 // TODO: remove this.
351 #if !defined(OS_LINUX) || defined(OS_CHROMEOS)
352 if (GetNativeTheme() == ui::NativeThemeAura::instance()) {
353 use_new_menu = true;
354 run_flags |= WrenchMenu::SUPPORTS_NEW_SEPARATORS | WrenchMenu::USE_NEW_MENU;
355 }
356 #endif
357
358 if (keyboard::KeyboardController::GetInstance() && 348 if (keyboard::KeyboardController::GetInstance() &&
359 keyboard::KeyboardController::GetInstance()->keyboard_visible()) { 349 keyboard::KeyboardController::GetInstance()->keyboard_visible()) {
360 keyboard::KeyboardController::GetInstance()->HideKeyboard( 350 keyboard::KeyboardController::GetInstance()->HideKeyboard(
361 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); 351 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
362 } 352 }
363 353
364 if (for_drop) 354 wrench_menu_.reset(
365 run_flags |= WrenchMenu::FOR_DROP; 355 new WrenchMenu(browser_, for_drop ? WrenchMenu::FOR_DROP : 0));
366 wrench_menu_.reset(new WrenchMenu(browser_, run_flags)); 356 wrench_menu_model_.reset(new WrenchMenuModel(this, browser_));
367 wrench_menu_model_.reset(new WrenchMenuModel(this, browser_, use_new_menu));
368 wrench_menu_->Init(wrench_menu_model_.get()); 357 wrench_menu_->Init(wrench_menu_model_.get());
369 358
370 FOR_EACH_OBSERVER(views::MenuListener, menu_listeners_, OnMenuOpened()); 359 FOR_EACH_OBSERVER(views::MenuListener, menu_listeners_, OnMenuOpened());
371 360
372 wrench_menu_->RunMenu(app_menu_); 361 wrench_menu_->RunMenu(app_menu_);
373 } 362 }
374 363
375 views::MenuButton* ToolbarView::app_menu() const { 364 views::MenuButton* ToolbarView::app_menu() const {
376 return app_menu_; 365 return app_menu_;
377 } 366 }
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 789
801 void ToolbarView::OnShowHomeButtonChanged() { 790 void ToolbarView::OnShowHomeButtonChanged() {
802 Layout(); 791 Layout();
803 SchedulePaint(); 792 SchedulePaint();
804 } 793 }
805 794
806 int ToolbarView::content_shadow_height() const { 795 int ToolbarView::content_shadow_height() const {
807 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 796 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
808 kContentShadowHeightAsh : kContentShadowHeight; 797 kContentShadowHeightAsh : kContentShadowHeight;
809 } 798 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc ('k') | chrome/browser/ui/views/toolbar/wrench_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698