| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
| 9 #include "chrome/browser/extensions/extension_browser_event_router.h" | 9 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (image) { | 177 if (image) { |
| 178 if (index < static_cast<int>(page_action_->icon_paths()->size())) | 178 if (index < static_cast<int>(page_action_->icon_paths()->size())) |
| 179 page_action_icons_[page_action_->icon_paths()->at(index)] = *image; | 179 page_action_icons_[page_action_->icon_paths()->at(index)] = *image; |
| 180 else | 180 else |
| 181 page_action_icons_[page_action_->default_icon_path()] = *image; | 181 page_action_icons_[page_action_->default_icon_path()] = *image; |
| 182 } | 182 } |
| 183 | 183 |
| 184 // During object construction (before the parent has been set) we are already | 184 // During object construction (before the parent has been set) we are already |
| 185 // in a UpdatePageActions call, so we don't need to start another one (and | 185 // in a UpdatePageActions call, so we don't need to start another one (and |
| 186 // doing so causes crash described in http://crbug.com/57333). | 186 // doing so causes crash described in http://crbug.com/57333). |
| 187 if (GetParent()) | 187 if (parent()) |
| 188 owner_->UpdatePageActions(); | 188 owner_->UpdatePageActions(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void PageActionImageView::UpdateVisibility(TabContents* contents, | 191 void PageActionImageView::UpdateVisibility(TabContents* contents, |
| 192 const GURL& url) { | 192 const GURL& url) { |
| 193 // Save this off so we can pass it back to the extension when the action gets | 193 // Save this off so we can pass it back to the extension when the action gets |
| 194 // executed. See PageActionImageView::OnMousePressed. | 194 // executed. See PageActionImageView::OnMousePressed. |
| 195 current_tab_id_ = contents ? ExtensionTabUtil::GetTabId(contents) : -1; | 195 current_tab_id_ = contents ? ExtensionTabUtil::GetTabId(contents) : -1; |
| 196 current_url_ = url; | 196 current_url_ = url; |
| 197 | 197 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 void PageActionImageView::ExtensionPopupIsClosing(ExtensionPopup* popup) { | 241 void PageActionImageView::ExtensionPopupIsClosing(ExtensionPopup* popup) { |
| 242 DCHECK_EQ(popup_, popup); | 242 DCHECK_EQ(popup_, popup); |
| 243 // ExtensionPopup is ref-counted, so we don't need to delete it. | 243 // ExtensionPopup is ref-counted, so we don't need to delete it. |
| 244 popup_ = NULL; | 244 popup_ = NULL; |
| 245 } | 245 } |
| 246 | 246 |
| 247 void PageActionImageView::HidePopup() { | 247 void PageActionImageView::HidePopup() { |
| 248 if (popup_) | 248 if (popup_) |
| 249 popup_->Close(); | 249 popup_->Close(); |
| 250 } | 250 } |
| OLD | NEW |