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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 GtkWidget* contents_; | 74 GtkWidget* contents_; |
75 | 75 |
76 // The widget relative to which we are positioned. | 76 // The widget relative to which we are positioned. |
77 GtkWidget* anchor_; | 77 GtkWidget* anchor_; |
78 | 78 |
79 // Provides colors and stuff. | 79 // Provides colors and stuff. |
80 GtkThemeService* theme_service_; | 80 GtkThemeService* theme_service_; |
81 | 81 |
82 BubbleGtk* bubble_; | 82 BubbleGtk* bubble_; |
83 | 83 |
| 84 Profile* profile_; |
| 85 |
84 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleGtk); | 86 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleGtk); |
85 }; | 87 }; |
86 | 88 |
87 PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent, | 89 PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent, |
88 Profile* profile, | 90 Profile* profile, |
89 const GURL& url, | 91 const GURL& url, |
90 const NavigationEntry::SSLStatus& ssl, | 92 const NavigationEntry::SSLStatus& ssl, |
91 bool show_history) | 93 bool show_history) |
92 : ALLOW_THIS_IN_INITIALIZER_LIST(model_(profile, url, ssl, | 94 : ALLOW_THIS_IN_INITIALIZER_LIST(model_(profile, url, ssl, |
93 show_history, this)), | 95 show_history, this)), |
94 url_(url), | 96 url_(url), |
95 cert_id_(ssl.cert_id()), | 97 cert_id_(ssl.cert_id()), |
96 parent_(parent), | 98 parent_(parent), |
97 contents_(NULL), | 99 contents_(NULL), |
98 theme_service_(GtkThemeService::GetFrom(profile)) { | 100 theme_service_(GtkThemeService::GetFrom(profile)), |
| 101 profile_(profile) { |
99 BrowserWindowGtk* browser_window = | 102 BrowserWindowGtk* browser_window = |
100 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); | 103 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); |
101 | 104 |
102 anchor_ = browser_window-> | 105 anchor_ = browser_window-> |
103 GetToolbar()->GetLocationBarView()->location_icon_widget(); | 106 GetToolbar()->GetLocationBarView()->location_icon_widget(); |
104 | 107 |
105 InitContents(); | 108 InitContents(); |
106 | 109 |
107 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ? | 110 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ? |
108 BubbleGtk::ARROW_LOCATION_TOP_RIGHT : | 111 BubbleGtk::ARROW_LOCATION_TOP_RIGHT : |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 220 } |
218 | 221 |
219 void PageInfoBubbleGtk::OnViewCertLinkClicked(GtkWidget* widget) { | 222 void PageInfoBubbleGtk::OnViewCertLinkClicked(GtkWidget* widget) { |
220 ShowCertificateViewerByID(GTK_WINDOW(parent_), cert_id_); | 223 ShowCertificateViewerByID(GTK_WINDOW(parent_), cert_id_); |
221 bubble_->Close(); | 224 bubble_->Close(); |
222 } | 225 } |
223 | 226 |
224 void PageInfoBubbleGtk::OnHelpLinkClicked(GtkWidget* widget) { | 227 void PageInfoBubbleGtk::OnHelpLinkClicked(GtkWidget* widget) { |
225 GURL url = google_util::AppendGoogleLocaleParam( | 228 GURL url = google_util::AppendGoogleLocaleParam( |
226 GURL(chrome::kPageInfoHelpCenterURL)); | 229 GURL(chrome::kPageInfoHelpCenterURL)); |
227 Browser* browser = BrowserList::GetLastActive(); | 230 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); |
228 browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); | 231 browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); |
229 bubble_->Close(); | 232 bubble_->Close(); |
230 } | 233 } |
231 | 234 |
232 } // namespace | 235 } // namespace |
233 | 236 |
234 namespace browser { | 237 namespace browser { |
235 | 238 |
236 void ShowPageInfoBubble(gfx::NativeWindow parent, | 239 void ShowPageInfoBubble(gfx::NativeWindow parent, |
237 Profile* profile, | 240 Profile* profile, |
238 const GURL& url, | 241 const GURL& url, |
239 const NavigationEntry::SSLStatus& ssl, | 242 const NavigationEntry::SSLStatus& ssl, |
240 bool show_history) { | 243 bool show_history) { |
241 new PageInfoBubbleGtk(parent, profile, url, ssl, show_history); | 244 new PageInfoBubbleGtk(parent, profile, url, ssl, show_history); |
242 } | 245 } |
243 | 246 |
244 } // namespace browser | 247 } // namespace browser |
OLD | NEW |