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

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

Issue 379483003: Fix use-after-free in BrowserActionOverflowMenuController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 | « chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.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 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/browser_actions_container.h" 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 continue; 229 continue;
230 230
231 BrowserActionView* view = new BrowserActionView(i->get(), browser_, this); 231 BrowserActionView* view = new BrowserActionView(i->get(), browser_, this);
232 browser_action_views_.push_back(view); 232 browser_action_views_.push_back(view);
233 AddChildView(view); 233 AddChildView(view);
234 } 234 }
235 } 235 }
236 236
237 void BrowserActionsContainer::DeleteBrowserActionViews() { 237 void BrowserActionsContainer::DeleteBrowserActionViews() {
238 HidePopup(); 238 HidePopup();
239 if (overflow_menu_)
msw 2014/07/09 16:56:27 Can we simply close the overflow menu on DeleteBro
Devlin 2014/07/09 19:23:27 I'm not sure that we can safely - DeleteBrowserAct
240 overflow_menu_->NotifyBrowserActionViewsDeleting();
239 STLDeleteElements(&browser_action_views_); 241 STLDeleteElements(&browser_action_views_);
240 } 242 }
241 243
242 size_t BrowserActionsContainer::VisibleBrowserActions() const { 244 size_t BrowserActionsContainer::VisibleBrowserActions() const {
243 size_t visible_actions = 0; 245 size_t visible_actions = 0;
244 for (size_t i = 0; i < browser_action_views_.size(); ++i) { 246 for (size_t i = 0; i < browser_action_views_.size(); ++i) {
245 if (browser_action_views_[i]->visible()) 247 if (browser_action_views_[i]->visible())
246 ++visible_actions; 248 ++visible_actions;
247 } 249 }
248 return visible_actions; 250 return visible_actions;
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 views::BubbleBorder::TOP_RIGHT, 1055 views::BubbleBorder::TOP_RIGHT,
1054 show_action); 1056 show_action);
1055 popup_->GetWidget()->AddObserver(this); 1057 popup_->GetWidget()->AddObserver(this);
1056 popup_button_ = button; 1058 popup_button_ = button;
1057 1059
1058 // Only set button as pushed if it was triggered by a user click. 1060 // Only set button as pushed if it was triggered by a user click.
1059 if (should_grant) 1061 if (should_grant)
1060 popup_button_->SetButtonPushed(); 1062 popup_button_->SetButtonPushed();
1061 return true; 1063 return true;
1062 } 1064 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698