OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
asargent_no_longer_on_chrome
2011/01/07 18:09:47
Happy New Year!
| |
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/views/location_bar/page_action_image_view.h" | 5 #include "chrome/browser/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" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 | 76 |
77 // If we were already showing, then treat this click as a dismiss. | 77 // If we were already showing, then treat this click as a dismiss. |
78 if (popup_showing) | 78 if (popup_showing) |
79 return; | 79 return; |
80 | 80 |
81 gfx::Rect screen_bounds(GetImageBounds()); | 81 gfx::Rect screen_bounds(GetImageBounds()); |
82 gfx::Point origin(screen_bounds.origin()); | 82 gfx::Point origin(screen_bounds.origin()); |
83 View::ConvertPointToScreen(this, &origin); | 83 View::ConvertPointToScreen(this, &origin); |
84 screen_bounds.set_origin(origin); | 84 screen_bounds.set_origin(origin); |
85 | 85 |
86 BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ? | |
87 BubbleBorder::TOP_LEFT : BubbleBorder::TOP_RIGHT; | |
88 | |
86 popup_ = ExtensionPopup::Show( | 89 popup_ = ExtensionPopup::Show( |
87 page_action_->GetPopupUrl(current_tab_id_), | 90 page_action_->GetPopupUrl(current_tab_id_), |
88 browser, | 91 browser, |
89 browser->profile(), | 92 browser->profile(), |
90 browser->window()->GetNativeHandle(), | 93 browser->window()->GetNativeHandle(), |
91 screen_bounds, | 94 screen_bounds, |
92 BubbleBorder::TOP_RIGHT, | 95 arrow_location, |
93 true, // Activate the popup window. | 96 true, // Activate the popup window. |
94 inspect_with_devtools, | 97 inspect_with_devtools, |
95 ExtensionPopup::BUBBLE_CHROME, | 98 ExtensionPopup::BUBBLE_CHROME, |
96 this); // ExtensionPopup::Observer | 99 this); // ExtensionPopup::Observer |
97 } else { | 100 } else { |
98 ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted( | 101 ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted( |
99 profile_, page_action_->extension_id(), page_action_->id(), | 102 profile_, page_action_->extension_id(), page_action_->id(), |
100 current_tab_id_, current_url_.spec(), button); | 103 current_tab_id_, current_url_.spec(), button); |
101 } | 104 } |
102 } | 105 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 void PageActionImageView::ExtensionPopupIsClosing(ExtensionPopup* popup) { | 237 void PageActionImageView::ExtensionPopupIsClosing(ExtensionPopup* popup) { |
235 DCHECK_EQ(popup_, popup); | 238 DCHECK_EQ(popup_, popup); |
236 // ExtensionPopup is ref-counted, so we don't need to delete it. | 239 // ExtensionPopup is ref-counted, so we don't need to delete it. |
237 popup_ = NULL; | 240 popup_ = NULL; |
238 } | 241 } |
239 | 242 |
240 void PageActionImageView::HidePopup() { | 243 void PageActionImageView::HidePopup() { |
241 if (popup_) | 244 if (popup_) |
242 popup_->Close(); | 245 popup_->Close(); |
243 } | 246 } |
OLD | NEW |