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