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/extension_command_service.h" | 8 #include "chrome/browser/extensions/api/commands/extension_command_service.h" |
9 #include "chrome/browser/extensions/api/commands/extension_command_service_facto
ry.h" | 9 #include "chrome/browser/extensions/api/commands/extension_command_service_facto
ry.h" |
10 #include "chrome/browser/extensions/extension_browser_event_router.h" | 10 #include "chrome/browser/extensions/extension_browser_event_router.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 std::string icon_path = (icon_index < 0) ? | 249 std::string icon_path = (icon_index < 0) ? |
250 page_action_->default_icon_path() : | 250 page_action_->default_icon_path() : |
251 page_action_->icon_paths()->at(icon_index); | 251 page_action_->icon_paths()->at(icon_index); |
252 if (!icon_path.empty()) { | 252 if (!icon_path.empty()) { |
253 PageActionMap::iterator iter = page_action_icons_.find(icon_path); | 253 PageActionMap::iterator iter = page_action_icons_.find(icon_path); |
254 if (iter != page_action_icons_.end()) | 254 if (iter != page_action_icons_.end()) |
255 icon = iter->second; | 255 icon = iter->second; |
256 } | 256 } |
257 } | 257 } |
258 if (!icon.isNull()) | 258 if (!icon.isNull()) |
259 SetImage(&icon); | 259 SetImage(icon); |
260 | 260 |
261 SetVisible(true); | 261 SetVisible(true); |
262 } | 262 } |
263 | 263 |
264 void PageActionImageView::OnWidgetClosing(views::Widget* widget) { | 264 void PageActionImageView::OnWidgetClosing(views::Widget* widget) { |
265 DCHECK_EQ(popup_->GetWidget(), widget); | 265 DCHECK_EQ(popup_->GetWidget(), widget); |
266 popup_->GetWidget()->RemoveObserver(this); | 266 popup_->GetWidget()->RemoveObserver(this); |
267 popup_ = NULL; | 267 popup_ = NULL; |
268 } | 268 } |
269 | 269 |
270 void PageActionImageView::Observe(int type, | 270 void PageActionImageView::Observe(int type, |
271 const content::NotificationSource& source, | 271 const content::NotificationSource& source, |
272 const content::NotificationDetails& details) { | 272 const content::NotificationDetails& details) { |
273 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); | 273 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); |
274 const Extension* unloaded_extension = | 274 const Extension* unloaded_extension = |
275 content::Details<UnloadedExtensionInfo>(details)->extension; | 275 content::Details<UnloadedExtensionInfo>(details)->extension; |
276 if (page_action_ == unloaded_extension ->page_action()) | 276 if (page_action_ == unloaded_extension ->page_action()) |
277 owner_->UpdatePageActions(); | 277 owner_->UpdatePageActions(); |
278 } | 278 } |
279 | 279 |
280 void PageActionImageView::HidePopup() { | 280 void PageActionImageView::HidePopup() { |
281 if (popup_) | 281 if (popup_) |
282 popup_->GetWidget()->Close(); | 282 popup_->GetWidget()->Close(); |
283 } | 283 } |
OLD | NEW |