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

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

Issue 2684993009: Stop MenuItemView From Directly Caching MenuController (Closed)
Patch Set: Created 3 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
« no previous file with comments | « ui/views/controls/menu/menu_item_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/submenu_view.h" 5 #include "ui/views/controls/menu/submenu_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "ui/accessibility/ax_node_data.h" 10 #include "ui/accessibility/ax_node_data.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (!scroll_view_container_) { 447 if (!scroll_view_container_) {
448 scroll_view_container_ = new MenuScrollViewContainer(this); 448 scroll_view_container_ = new MenuScrollViewContainer(this);
449 // Otherwise MenuHost would delete us. 449 // Otherwise MenuHost would delete us.
450 scroll_view_container_->set_owned_by_client(); 450 scroll_view_container_->set_owned_by_client();
451 } 451 }
452 return scroll_view_container_; 452 return scroll_view_container_;
453 } 453 }
454 454
455 void SubmenuView::MenuHostDestroyed() { 455 void SubmenuView::MenuHostDestroyed() {
456 host_ = NULL; 456 host_ = NULL;
457 GetMenuItem()->GetMenuController()->Cancel(MenuController::EXIT_DESTROYED); 457 MenuController* controller = GetMenuItem()->GetMenuController();
458 if (controller)
459 controller->Cancel(MenuController::EXIT_DESTROYED);
458 } 460 }
459 461
460 const char* SubmenuView::GetClassName() const { 462 const char* SubmenuView::GetClassName() const {
461 return kViewClassName; 463 return kViewClassName;
462 } 464 }
463 465
464 void SubmenuView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 466 void SubmenuView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
465 SchedulePaint(); 467 SchedulePaint();
466 } 468 }
467 469
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 y = std::max(y, 0); 514 y = std::max(y, 0);
513 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height()); 515 gfx::Rect new_vis_bounds(x, y, vis_bounds.width(), vis_bounds.height());
514 if (new_vis_bounds != vis_bounds) { 516 if (new_vis_bounds != vis_bounds) {
515 ScrollRectToVisible(new_vis_bounds); 517 ScrollRectToVisible(new_vis_bounds);
516 return true; 518 return true;
517 } 519 }
518 return false; 520 return false;
519 } 521 }
520 522
521 } // namespace views 523 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_item_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698