Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: chrome/browser/ui/gtk/page_info_bubble_gtk.cc

Issue 10413061: Make PageInfoBubble not use BrowserList::GetLastActive and instead obtain a navigator at creation t… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/page_info_bubble.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <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 22 matching lines...) Expand all
33 33
34 namespace { 34 namespace {
35 35
36 class PageInfoBubbleGtk : public PageInfoModelObserver, 36 class PageInfoBubbleGtk : public PageInfoModelObserver,
37 public BubbleDelegateGtk { 37 public BubbleDelegateGtk {
38 public: 38 public:
39 PageInfoBubbleGtk(gfx::NativeWindow parent, 39 PageInfoBubbleGtk(gfx::NativeWindow parent,
40 Profile* profile, 40 Profile* profile,
41 const GURL& url, 41 const GURL& url,
42 const SSLStatus& ssl, 42 const SSLStatus& ssl,
43 bool show_history); 43 bool show_history,
44 content::PageNavigator* navigator);
44 virtual ~PageInfoBubbleGtk(); 45 virtual ~PageInfoBubbleGtk();
45 46
46 // PageInfoModelObserver implementation. 47 // PageInfoModelObserver implementation.
47 virtual void OnPageInfoModelChanged() OVERRIDE; 48 virtual void OnPageInfoModelChanged() OVERRIDE;
48 49
49 // BubbleDelegateGtk implementation. 50 // BubbleDelegateGtk implementation.
50 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; 51 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE;
51 52
52 private: 53 private:
53 // Layouts the different sections retrieved from the model. 54 // Layouts the different sections retrieved from the model.
(...skipping 24 matching lines...) Expand all
78 // The widget relative to which we are positioned. 79 // The widget relative to which we are positioned.
79 GtkWidget* anchor_; 80 GtkWidget* anchor_;
80 81
81 // Provides colors and stuff. 82 // Provides colors and stuff.
82 GtkThemeService* theme_service_; 83 GtkThemeService* theme_service_;
83 84
84 BubbleGtk* bubble_; 85 BubbleGtk* bubble_;
85 86
86 Profile* profile_; 87 Profile* profile_;
87 88
89 // Used for loading pages.
90 content::PageNavigator* navigator_;
91
88 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleGtk); 92 DISALLOW_COPY_AND_ASSIGN(PageInfoBubbleGtk);
89 }; 93 };
90 94
91 PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent, 95 PageInfoBubbleGtk::PageInfoBubbleGtk(gfx::NativeWindow parent,
92 Profile* profile, 96 Profile* profile,
93 const GURL& url, 97 const GURL& url,
94 const SSLStatus& ssl, 98 const SSLStatus& ssl,
95 bool show_history) 99 bool show_history,
100 content::PageNavigator* navigator)
96 : ALLOW_THIS_IN_INITIALIZER_LIST(model_(profile, url, ssl, 101 : ALLOW_THIS_IN_INITIALIZER_LIST(model_(profile, url, ssl,
97 show_history, this)), 102 show_history, this)),
98 url_(url), 103 url_(url),
99 cert_id_(ssl.cert_id), 104 cert_id_(ssl.cert_id),
100 parent_(parent), 105 parent_(parent),
101 contents_(NULL), 106 contents_(NULL),
102 theme_service_(GtkThemeService::GetFrom(profile)), 107 theme_service_(GtkThemeService::GetFrom(profile)),
103 profile_(profile) { 108 profile_(profile),
109 navigator_(navigator) {
104 BrowserWindowGtk* browser_window = 110 BrowserWindowGtk* browser_window =
105 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); 111 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent);
106 112
107 anchor_ = browser_window-> 113 anchor_ = browser_window->
108 GetToolbar()->GetLocationBarView()->location_icon_widget(); 114 GetToolbar()->GetLocationBarView()->location_icon_widget();
109 115
110 InitContents(); 116 InitContents();
111 117
112 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ? 118 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ?
113 BubbleGtk::ARROW_LOCATION_TOP_RIGHT : 119 BubbleGtk::ARROW_LOCATION_TOP_RIGHT :
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 227
222 return section_box; 228 return section_box;
223 } 229 }
224 230
225 void PageInfoBubbleGtk::OnViewCertLinkClicked(GtkWidget* widget) { 231 void PageInfoBubbleGtk::OnViewCertLinkClicked(GtkWidget* widget) {
226 ShowCertificateViewerByID(GTK_WINDOW(parent_), cert_id_); 232 ShowCertificateViewerByID(GTK_WINDOW(parent_), cert_id_);
227 bubble_->Close(); 233 bubble_->Close();
228 } 234 }
229 235
230 void PageInfoBubbleGtk::OnHelpLinkClicked(GtkWidget* widget) { 236 void PageInfoBubbleGtk::OnHelpLinkClicked(GtkWidget* widget) {
231 Browser* browser = browser::FindLastActiveWithProfile(profile_); 237 navigator_->OpenURL(OpenURLParams(GURL(chrome::kPageInfoHelpCenterURL),
232 browser->OpenURL(OpenURLParams( 238 content::Referrer(),
233 GURL(chrome::kPageInfoHelpCenterURL), content::Referrer(), 239 NEW_FOREGROUND_TAB,
234 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); 240 content::PAGE_TRANSITION_LINK,
241 false));
235 bubble_->Close(); 242 bubble_->Close();
236 } 243 }
237 244
238 } // namespace 245 } // namespace
239 246
240 namespace browser { 247 namespace browser {
241 248
242 void ShowPageInfoBubble(gfx::NativeWindow parent, 249 void ShowPageInfoBubble(gfx::NativeWindow parent,
243 Profile* profile, 250 Profile* profile,
244 const GURL& url, 251 const GURL& url,
245 const SSLStatus& ssl, 252 const SSLStatus& ssl,
246 bool show_history) { 253 bool show_history,
247 new PageInfoBubbleGtk(parent, profile, url, ssl, show_history); 254 content::PageNavigator* navigator) {
255 new PageInfoBubbleGtk(parent, profile, url, ssl, show_history, navigator);
248 } 256 }
249 257
250 } // namespace browser 258 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.cc ('k') | chrome/browser/ui/page_info_bubble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698