OLD | NEW |
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/utf_string_conversions.h" | 7 #include "base/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/api/commands/command_service_factory.h" | 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
10 #include "chrome/browser/extensions/extension_context_menu_model.h" | 10 #include "chrome/browser/extensions/extension_context_menu_model.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 SetVisible(false); | 264 SetVisible(false); |
265 return; | 265 return; |
266 } | 266 } |
267 | 267 |
268 // Set the tooltip. | 268 // Set the tooltip. |
269 tooltip_ = page_action_->GetTitle(current_tab_id_); | 269 tooltip_ = page_action_->GetTitle(current_tab_id_); |
270 SetTooltipText(UTF8ToUTF16(tooltip_)); | 270 SetTooltipText(UTF8ToUTF16(tooltip_)); |
271 | 271 |
272 // Set the image. | 272 // Set the image. |
273 gfx::Image icon = page_action_->GetIcon(current_tab_id_); | 273 gfx::Image icon = page_action_->GetIcon(current_tab_id_); |
274 if (!icon.IsEmpty()) { | 274 if (!icon.IsEmpty()) |
275 SetImage(*icon.ToImageSkia()); | 275 SetImage(*icon.ToImageSkia()); |
276 } | |
277 | 276 |
278 SetVisible(true); | 277 SetVisible(true); |
279 } | 278 } |
280 | 279 |
281 void PageActionImageView::OnWidgetClosing(views::Widget* widget) { | 280 void PageActionImageView::OnWidgetClosing(views::Widget* widget) { |
282 DCHECK_EQ(popup_->GetWidget(), widget); | 281 DCHECK_EQ(popup_->GetWidget(), widget); |
283 popup_->GetWidget()->RemoveObserver(this); | 282 popup_->GetWidget()->RemoveObserver(this); |
284 popup_ = NULL; | 283 popup_ = NULL; |
285 } | 284 } |
286 | 285 |
(...skipping 28 matching lines...) Expand all Loading... |
315 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; | 314 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; |
316 | 315 |
317 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location); | 316 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location); |
318 popup_->GetWidget()->AddObserver(this); | 317 popup_->GetWidget()->AddObserver(this); |
319 } | 318 } |
320 | 319 |
321 void PageActionImageView::HidePopup() { | 320 void PageActionImageView::HidePopup() { |
322 if (popup_) | 321 if (popup_) |
323 popup_->GetWidget()->Close(); | 322 popup_->GetWidget()->Close(); |
324 } | 323 } |
OLD | NEW |