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

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 547303003: Keep reference view pressed while extension actions have a popup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 CloseAllNestedMenus(); 428 CloseAllNestedMenus();
429 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT); 429 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT);
430 430
431 // Set exit_all_, which makes sure all nested loops exit immediately. 431 // Set exit_all_, which makes sure all nested loops exit immediately.
432 if (exit_type_ != EXIT_DESTROYED) 432 if (exit_type_ != EXIT_DESTROYED)
433 SetExitType(EXIT_ALL); 433 SetExitType(EXIT_ALL);
434 } 434 }
435 } 435 }
436 436
437 // If we stopped running because one of the menus was destroyed chances are 437 // If we stopped running because one of the menus was destroyed chances are
438 // the button was also destroyed. 438 // the button was also destroyed. If there is a menu visible on the button, it
439 if (exit_type_ != EXIT_DESTROYED && menu_button_) { 439 // will clean itself up.
440 if (exit_type_ != EXIT_DESTROYED &&
441 menu_button_ &&
442 !menu_button_->menu_visible())
440 menu_button_->SetState(CustomButton::STATE_NORMAL); 443 menu_button_->SetState(CustomButton::STATE_NORMAL);
441 menu_button_->SchedulePaint();
442 }
443 return result; 444 return result;
444 } 445 }
445 446
446 void MenuController::Cancel(ExitType type) { 447 void MenuController::Cancel(ExitType type) {
447 // If the menu has already been destroyed, no further cancellation is 448 // If the menu has already been destroyed, no further cancellation is
448 // needed. We especially don't want to set the |exit_type_| to a lesser 449 // needed. We especially don't want to set the |exit_type_| to a lesser
449 // value. 450 // value.
450 if (exit_type_ == EXIT_DESTROYED || exit_type_ == type) 451 if (exit_type_ == EXIT_DESTROYED || exit_type_ == type)
451 return; 452 return;
452 453
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 } 2310 }
2310 } 2311 }
2311 2312
2312 gfx::Screen* MenuController::GetScreen() { 2313 gfx::Screen* MenuController::GetScreen() {
2313 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; 2314 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL;
2314 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) 2315 return root ? gfx::Screen::GetScreenFor(root->GetNativeView())
2315 : gfx::Screen::GetNativeScreen(); 2316 : gfx::Screen::GetNativeScreen();
2316 } 2317 }
2317 2318
2318 } // namespace views 2319 } // namespace views
OLDNEW
« ui/views/controls/button/menu_button.h ('K') | « ui/views/controls/button/menu_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698