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

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

Issue 2901193002: Fix nullptr dereference of ToolbarActionView (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | 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 <utility> 7 #include <utility>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ToolbarActionViewController* view_controller, 161 ToolbarActionViewController* view_controller,
162 size_t index) { 162 size_t index) {
163 ToolbarActionView* view = new ToolbarActionView(view_controller, this); 163 ToolbarActionView* view = new ToolbarActionView(view_controller, this);
164 toolbar_action_views_.insert(toolbar_action_views_.begin() + index, 164 toolbar_action_views_.insert(toolbar_action_views_.begin() + index,
165 base::WrapUnique(view)); 165 base::WrapUnique(view));
166 AddChildViewAt(view, index); 166 AddChildViewAt(view, index);
167 } 167 }
168 168
169 void BrowserActionsContainer::RemoveViewForAction( 169 void BrowserActionsContainer::RemoveViewForAction(
170 ToolbarActionViewController* action) { 170 ToolbarActionViewController* action) {
171 std::unique_ptr<ToolbarActionView> view;
171 for (ToolbarActionViews::iterator iter = toolbar_action_views_.begin(); 172 for (ToolbarActionViews::iterator iter = toolbar_action_views_.begin();
172 iter != toolbar_action_views_.end(); ++iter) { 173 iter != toolbar_action_views_.end(); ++iter) {
173 if ((*iter)->view_controller() == action) { 174 if ((*iter)->view_controller() == action) {
175 std::swap(view, *iter);
174 toolbar_action_views_.erase(iter); 176 toolbar_action_views_.erase(iter);
175 break; 177 break;
176 } 178 }
177 } 179 }
178 } 180 }
179 181
180 void BrowserActionsContainer::RemoveAllViews() { 182 void BrowserActionsContainer::RemoveAllViews() {
181 toolbar_action_views_.clear(); 183 toolbar_action_views_.clear();
182 } 184 }
183 185
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 660 }
659 } 661 }
660 662
661 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { 663 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) {
662 DCHECK(active_bubble_); 664 DCHECK(active_bubble_);
663 DCHECK_EQ(active_bubble_->GetWidget(), widget); 665 DCHECK_EQ(active_bubble_->GetWidget(), widget);
664 widget->RemoveObserver(this); 666 widget->RemoveObserver(this);
665 active_bubble_ = nullptr; 667 active_bubble_ = nullptr;
666 toolbar_actions_bar_->OnBubbleClosed(); 668 toolbar_actions_bar_->OnBubbleClosed();
667 } 669 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698