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/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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 popup_->GetWidget()->RemoveObserver(this); | 220 popup_->GetWidget()->RemoveObserver(this); |
221 popup_ = NULL; | 221 popup_ = NULL; |
222 } | 222 } |
223 | 223 |
224 void PageActionImageView::OnIconUpdated() { | 224 void PageActionImageView::OnIconUpdated() { |
225 WebContents* web_contents = owner_->GetWebContents(); | 225 WebContents* web_contents = owner_->GetWebContents(); |
226 if (web_contents) | 226 if (web_contents) |
227 UpdateVisibility(web_contents, current_url_); | 227 UpdateVisibility(web_contents, current_url_); |
228 } | 228 } |
229 | 229 |
230 void PageActionImageView::PaintChildren(gfx::Canvas* canvas) { | 230 void PageActionImageView::PaintChildren(gfx::Canvas* canvas, |
231 View::PaintChildren(canvas); | 231 const views::CullSet& cull_set) { |
| 232 View::PaintChildren(canvas, cull_set); |
232 if (current_tab_id_ >= 0) | 233 if (current_tab_id_ >= 0) |
233 page_action_->PaintBadge(canvas, GetLocalBounds(), current_tab_id_); | 234 page_action_->PaintBadge(canvas, GetLocalBounds(), current_tab_id_); |
234 } | 235 } |
235 | 236 |
236 void PageActionImageView::ShowPopupWithURL( | 237 void PageActionImageView::ShowPopupWithURL( |
237 const GURL& popup_url, | 238 const GURL& popup_url, |
238 ExtensionPopup::ShowAction show_action) { | 239 ExtensionPopup::ShowAction show_action) { |
239 bool popup_showing = popup_ != NULL; | 240 bool popup_showing = popup_ != NULL; |
240 | 241 |
241 // Always hide the current popup. Only one popup at a time. | 242 // Always hide the current popup. Only one popup at a time. |
242 HidePopup(); | 243 HidePopup(); |
243 | 244 |
244 // If we were already showing, then treat this click as a dismiss. | 245 // If we were already showing, then treat this click as a dismiss. |
245 if (popup_showing) | 246 if (popup_showing) |
246 return; | 247 return; |
247 | 248 |
248 views::BubbleBorder::Arrow arrow = base::i18n::IsRTL() ? | 249 views::BubbleBorder::Arrow arrow = base::i18n::IsRTL() ? |
249 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; | 250 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; |
250 | 251 |
251 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow, | 252 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow, |
252 show_action); | 253 show_action); |
253 popup_->GetWidget()->AddObserver(this); | 254 popup_->GetWidget()->AddObserver(this); |
254 } | 255 } |
255 | 256 |
256 void PageActionImageView::HidePopup() { | 257 void PageActionImageView::HidePopup() { |
257 if (popup_) | 258 if (popup_) |
258 popup_->GetWidget()->Close(); | 259 popup_->GetWidget()->Close(); |
259 } | 260 } |
OLD | NEW |