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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.cc

Issue 419023002: Move ShowPopup logic from BrowserActionsContainer to BrowserActionView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 "chrome/browser/ui/views/location_bar/page_action_image_view.h" 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/extensions/api/commands/command_service.h" 8 #include "chrome/browser/extensions/api/commands/command_service.h"
9 #include "chrome/browser/extensions/extension_action.h" 9 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/extensions/extension_action_icon_factory.h" 10 #include "chrome/browser/extensions/extension_action_icon_factory.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 SetTooltipText(base::UTF8ToUTF16(tooltip_)); 212 SetTooltipText(base::UTF8ToUTF16(tooltip_));
213 213
214 // Set the image. 214 // Set the image.
215 gfx::Image icon = icon_factory_->GetIcon(current_tab_id_); 215 gfx::Image icon = icon_factory_->GetIcon(current_tab_id_);
216 if (!icon.IsEmpty()) 216 if (!icon.IsEmpty())
217 SetImage(*icon.ToImageSkia()); 217 SetImage(*icon.ToImageSkia());
218 218
219 SetVisible(true); 219 SetVisible(true);
220 } 220 }
221 221
222 void PageActionImageView::InspectPopup(ExtensionAction* action) { 222 void PageActionImageView::InspectPopup() {
223 ExecuteAction(ExtensionPopup::SHOW_AND_INSPECT); 223 ExecuteAction(ExtensionPopup::SHOW_AND_INSPECT);
224 } 224 }
225 225
226 void PageActionImageView::OnWidgetDestroying(views::Widget* widget) { 226 void PageActionImageView::OnWidgetDestroying(views::Widget* widget) {
227 DCHECK_EQ(popup_->GetWidget(), widget); 227 DCHECK_EQ(popup_->GetWidget(), widget);
228 popup_->GetWidget()->RemoveObserver(this); 228 popup_->GetWidget()->RemoveObserver(this);
229 popup_ = NULL; 229 popup_ = NULL;
230 } 230 }
231 231
232 void PageActionImageView::OnIconUpdated() { 232 void PageActionImageView::OnIconUpdated() {
(...skipping 26 matching lines...) Expand all
259 259
260 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow, 260 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow,
261 show_action); 261 show_action);
262 popup_->GetWidget()->AddObserver(this); 262 popup_->GetWidget()->AddObserver(this);
263 } 263 }
264 264
265 void PageActionImageView::HidePopup() { 265 void PageActionImageView::HidePopup() {
266 if (popup_) 266 if (popup_)
267 popup_->GetWidget()->Close(); 267 popup_->GetWidget()->Close();
268 } 268 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698