OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/extension_popup_gtk.h" | 5 #include "chrome/browser/gtk/extension_popup_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "base/i18n/rtl.h" |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
11 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
12 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
13 #include "chrome/browser/extensions/extension_host.h" | 13 #include "chrome/browser/extensions/extension_host.h" |
14 #include "chrome/browser/extensions/extension_process_manager.h" | 14 #include "chrome/browser/extensions/extension_process_manager.h" |
15 #include "chrome/browser/gtk/gtk_theme_provider.h" | 15 #include "chrome/browser/gtk/gtk_theme_provider.h" |
16 #include "chrome/common/notification_service.h" | 16 #include "chrome/common/notification_service.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 | 18 |
19 ExtensionPopupGtk* ExtensionPopupGtk::current_extension_popup_ = NULL; | 19 ExtensionPopupGtk* ExtensionPopupGtk::current_extension_popup_ = NULL; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // non-NULL if a browser action button is clicked while another extension | 67 // non-NULL if a browser action button is clicked while another extension |
68 // popup's extension host is still loading. | 68 // popup's extension host is still loading. |
69 if (current_extension_popup_) | 69 if (current_extension_popup_) |
70 current_extension_popup_->DestroyPopup(); | 70 current_extension_popup_->DestroyPopup(); |
71 current_extension_popup_ = this; | 71 current_extension_popup_ = this; |
72 | 72 |
73 // We'll be in the upper-right corner of the window for LTR languages, so we | 73 // We'll be in the upper-right corner of the window for LTR languages, so we |
74 // want to put the arrow at the upper-right corner of the bubble to match the | 74 // want to put the arrow at the upper-right corner of the bubble to match the |
75 // page and app menus. | 75 // page and app menus. |
76 InfoBubbleGtk::ArrowLocationGtk arrow_location = | 76 InfoBubbleGtk::ArrowLocationGtk arrow_location = |
77 (l10n_util::GetTextDirection() == l10n_util::LEFT_TO_RIGHT) ? | 77 !base::i18n::IsRTL() ? |
78 InfoBubbleGtk::ARROW_LOCATION_TOP_RIGHT : | 78 InfoBubbleGtk::ARROW_LOCATION_TOP_RIGHT : |
79 InfoBubbleGtk::ARROW_LOCATION_TOP_LEFT; | 79 InfoBubbleGtk::ARROW_LOCATION_TOP_LEFT; |
80 bubble_ = InfoBubbleGtk::Show(browser_->window()->GetNativeHandle(), | 80 bubble_ = InfoBubbleGtk::Show(browser_->window()->GetNativeHandle(), |
81 relative_to_, | 81 relative_to_, |
82 host_->view()->native_view(), | 82 host_->view()->native_view(), |
83 arrow_location, | 83 arrow_location, |
84 false, | 84 false, |
85 GtkThemeProvider::GetFrom(browser_->profile()), | 85 GtkThemeProvider::GetFrom(browser_->profile()), |
86 this); | 86 this); |
87 } | 87 } |
(...skipping 24 matching lines...) Expand all Loading... |
112 return; | 112 return; |
113 | 113 |
114 ExtensionHost* host = manager->CreatePopup(url, browser); | 114 ExtensionHost* host = manager->CreatePopup(url, browser); |
115 // This object will delete itself when the info bubble is closed. | 115 // This object will delete itself when the info bubble is closed. |
116 new ExtensionPopupGtk(browser, host, relative_to); | 116 new ExtensionPopupGtk(browser, host, relative_to); |
117 } | 117 } |
118 | 118 |
119 gfx::Rect ExtensionPopupGtk::GetViewBounds() { | 119 gfx::Rect ExtensionPopupGtk::GetViewBounds() { |
120 return gfx::Rect(host_->view()->native_view()->allocation); | 120 return gfx::Rect(host_->view()->native_view()->allocation); |
121 } | 121 } |
OLD | NEW |