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

Side by Side Diff: chrome/browser/plugin_infobar_delegates.cc

Issue 10830353: Introduce InfoBarTabService API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments, merge to LKGR Created 8 years, 4 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
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 "chrome/browser/plugin_infobar_delegates.h" 5 #include "chrome/browser/plugin_infobar_delegates.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/api/infobars/infobar_tab_service.h"
8 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
9 #include "chrome/browser/google/google_util.h" 10 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/infobars/infobar_tab_helper.h"
11 #include "chrome/browser/plugin_observer.h" 11 #include "chrome/browser/plugin_observer.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents.h" 12 #include "chrome/browser/ui/tab_contents/tab_contents.h"
13 #include "chrome/common/render_messages.h" 13 #include "chrome/common/render_messages.h"
14 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
15 #include "content/public/browser/render_view_host.h" 15 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/user_metrics.h" 16 #include "content/public/browser/user_metrics.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "grit/locale_settings.h" 19 #include "grit/locale_settings.h"
20 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "webkit/plugins/npapi/plugin_group.h" 23 #include "webkit/plugins/npapi/plugin_group.h"
24 24
25 #if defined(OS_WIN) 25 #if defined(OS_WIN)
26 #include <shellapi.h> 26 #include <shellapi.h>
27 #include "ui/base/win/shell.h" 27 #include "ui/base/win/shell.h"
28 #endif 28 #endif
29 29
30 #if defined(ENABLE_PLUGIN_INSTALLATION) 30 #if defined(ENABLE_PLUGIN_INSTALLATION)
31 #include "chrome/browser/plugin_installer.h" 31 #include "chrome/browser/plugin_installer.h"
32 #endif // defined(ENABLE_PLUGIN_INSTALLATION) 32 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
33 33
34 using content::OpenURLParams; 34 using content::OpenURLParams;
35 using content::Referrer; 35 using content::Referrer;
36 using content::UserMetricsAction; 36 using content::UserMetricsAction;
37 37
38 PluginInfoBarDelegate::PluginInfoBarDelegate(InfoBarTabHelper* infobar_helper, 38 PluginInfoBarDelegate::PluginInfoBarDelegate(InfoBarTabService* infobar_service,
39 const string16& name, 39 const string16& name,
40 const std::string& identifier) 40 const std::string& identifier)
41 : ConfirmInfoBarDelegate(infobar_helper), 41 : ConfirmInfoBarDelegate(infobar_service),
42 name_(name), 42 name_(name),
43 identifier_(identifier) { 43 identifier_(identifier) {
44 } 44 }
45 45
46 PluginInfoBarDelegate::~PluginInfoBarDelegate() { 46 PluginInfoBarDelegate::~PluginInfoBarDelegate() {
47 } 47 }
48 48
49 bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { 49 bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
50 OpenURLParams params( 50 OpenURLParams params(
51 GURL(GetLearnMoreURL()), Referrer(), 51 GURL(GetLearnMoreURL()), Referrer(),
52 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 52 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
53 content::PAGE_TRANSITION_LINK, 53 content::PAGE_TRANSITION_LINK,
54 false); 54 false);
55 owner()->web_contents()->OpenURL(params); 55 owner()->GetWebContents()->OpenURL(params);
56 return false; 56 return false;
57 } 57 }
58 58
59 void PluginInfoBarDelegate::LoadBlockedPlugins() { 59 void PluginInfoBarDelegate::LoadBlockedPlugins() {
60 owner()->Send( 60 content::WebContents* web_contents = owner()->GetWebContents();
61 new ChromeViewMsg_LoadBlockedPlugins(owner()->routing_id(), identifier_)); 61 if (web_contents) {
62 web_contents->Send(new ChromeViewMsg_LoadBlockedPlugins(
63 web_contents->GetRoutingID(), identifier_));
64 }
62 } 65 }
63 66
64 gfx::Image* PluginInfoBarDelegate::GetIcon() const { 67 gfx::Image* PluginInfoBarDelegate::GetIcon() const {
65 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 68 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
66 IDR_INFOBAR_PLUGIN_INSTALL); 69 IDR_INFOBAR_PLUGIN_INSTALL);
67 } 70 }
68 71
69 string16 PluginInfoBarDelegate::GetLinkText() const { 72 string16 PluginInfoBarDelegate::GetLinkText() const {
70 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 73 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
71 } 74 }
72 75
73 // UnauthorizedPluginInfoBarDelegate ------------------------------------------ 76 // UnauthorizedPluginInfoBarDelegate ------------------------------------------
74 77
75 UnauthorizedPluginInfoBarDelegate::UnauthorizedPluginInfoBarDelegate( 78 UnauthorizedPluginInfoBarDelegate::UnauthorizedPluginInfoBarDelegate(
76 InfoBarTabHelper* infobar_helper, 79 InfoBarTabService* infobar_service,
77 HostContentSettingsMap* content_settings, 80 HostContentSettingsMap* content_settings,
78 const string16& utf16_name, 81 const string16& utf16_name,
79 const std::string& identifier) 82 const std::string& identifier)
80 : PluginInfoBarDelegate(infobar_helper, utf16_name, identifier), 83 : PluginInfoBarDelegate(infobar_service, utf16_name, identifier),
81 content_settings_(content_settings) { 84 content_settings_(content_settings) {
82 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown")); 85 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown"));
83 std::string name = UTF16ToUTF8(utf16_name); 86 std::string name = UTF16ToUTF8(utf16_name);
84 if (name == webkit::npapi::PluginGroup::kJavaGroupName) 87 if (name == webkit::npapi::PluginGroup::kJavaGroupName)
85 content::RecordAction( 88 content::RecordAction(
86 UserMetricsAction("BlockedPluginInfobar.Shown.Java")); 89 UserMetricsAction("BlockedPluginInfobar.Shown.Java"));
87 else if (name == webkit::npapi::PluginGroup::kQuickTimeGroupName) 90 else if (name == webkit::npapi::PluginGroup::kQuickTimeGroupName)
88 content::RecordAction( 91 content::RecordAction(
89 UserMetricsAction("BlockedPluginInfobar.Shown.QuickTime")); 92 UserMetricsAction("BlockedPluginInfobar.Shown.QuickTime"));
90 else if (name == webkit::npapi::PluginGroup::kShockwaveGroupName) 93 else if (name == webkit::npapi::PluginGroup::kShockwaveGroupName)
(...skipping 28 matching lines...) Expand all
119 bool UnauthorizedPluginInfoBarDelegate::Accept() { 122 bool UnauthorizedPluginInfoBarDelegate::Accept() {
120 content::RecordAction( 123 content::RecordAction(
121 UserMetricsAction("BlockedPluginInfobar.AllowThisTime")); 124 UserMetricsAction("BlockedPluginInfobar.AllowThisTime"));
122 LoadBlockedPlugins(); 125 LoadBlockedPlugins();
123 return true; 126 return true;
124 } 127 }
125 128
126 bool UnauthorizedPluginInfoBarDelegate::Cancel() { 129 bool UnauthorizedPluginInfoBarDelegate::Cancel() {
127 content::RecordAction( 130 content::RecordAction(
128 UserMetricsAction("BlockedPluginInfobar.AlwaysAllow")); 131 UserMetricsAction("BlockedPluginInfobar.AlwaysAllow"));
129 content_settings_->AddExceptionForURL(owner()->web_contents()->GetURL(), 132 content_settings_->AddExceptionForURL(owner()->GetWebContents()->GetURL(),
130 owner()->web_contents()->GetURL(), 133 owner()->GetWebContents()->GetURL(),
131 CONTENT_SETTINGS_TYPE_PLUGINS, 134 CONTENT_SETTINGS_TYPE_PLUGINS,
132 std::string(), 135 std::string(),
133 CONTENT_SETTING_ALLOW); 136 CONTENT_SETTING_ALLOW);
134 LoadBlockedPlugins(); 137 LoadBlockedPlugins();
135 return true; 138 return true;
136 } 139 }
137 140
138 void UnauthorizedPluginInfoBarDelegate::InfoBarDismissed() { 141 void UnauthorizedPluginInfoBarDelegate::InfoBarDismissed() {
139 content::RecordAction( 142 content::RecordAction(
140 UserMetricsAction("BlockedPluginInfobar.Dismissed")); 143 UserMetricsAction("BlockedPluginInfobar.Dismissed"));
(...skipping 25 matching lines...) Expand all
166 } 169 }
167 return new OutdatedPluginInfoBarDelegate( 170 return new OutdatedPluginInfoBarDelegate(
168 observer, installer, message); 171 observer, installer, message);
169 } 172 }
170 173
171 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( 174 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate(
172 PluginObserver* observer, 175 PluginObserver* observer,
173 PluginInstaller* installer, 176 PluginInstaller* installer,
174 const string16& message) 177 const string16& message)
175 : PluginInfoBarDelegate( 178 : PluginInfoBarDelegate(
176 observer->tab_contents()->infobar_tab_helper(), 179
180 InfoBarTabService::ForTab(observer->tab_contents()),
177 installer->name(), 181 installer->name(),
178 installer->identifier()), 182 installer->identifier()),
179 WeakPluginInstallerObserver(installer), 183 WeakPluginInstallerObserver(installer),
180 observer_(observer), 184 observer_(observer),
181 message_(message) { 185 message_(message) {
182 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); 186 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown"));
183 std::string name = UTF16ToUTF8(installer->name()); 187 std::string name = UTF16ToUTF8(installer->name());
184 if (name == webkit::npapi::PluginGroup::kJavaGroupName) 188 if (name == webkit::npapi::PluginGroup::kJavaGroupName)
185 content::RecordAction( 189 content::RecordAction(
186 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); 190 UserMetricsAction("OutdatedPluginInfobar.Shown.Java"));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY); 223 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY);
220 } 224 }
221 225
222 bool OutdatedPluginInfoBarDelegate::Accept() { 226 bool OutdatedPluginInfoBarDelegate::Accept() {
223 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); 227 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update"));
224 if (installer()->state() != PluginInstaller::INSTALLER_STATE_IDLE) { 228 if (installer()->state() != PluginInstaller::INSTALLER_STATE_IDLE) {
225 NOTREACHED(); 229 NOTREACHED();
226 return false; 230 return false;
227 } 231 }
228 232
229 content::WebContents* web_contents = owner()->web_contents(); 233 content::WebContents* web_contents = owner()->GetWebContents();
230 if (installer()->url_for_display()) { 234 if (installer()->url_for_display()) {
231 installer()->OpenDownloadURL(web_contents); 235 installer()->OpenDownloadURL(web_contents);
232 } else { 236 } else {
233 installer()->StartInstalling(observer_->tab_contents()); 237 installer()->StartInstalling(observer_->tab_contents());
234 } 238 }
235 return false; 239 return false;
236 } 240 }
237 241
238 bool OutdatedPluginInfoBarDelegate::Cancel() { 242 bool OutdatedPluginInfoBarDelegate::Cancel() {
239 content::RecordAction( 243 content::RecordAction(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (!owner()) 294 if (!owner())
291 return; 295 return;
292 InfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate( 296 InfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate(
293 owner(), installer(), base::Closure(), false, message); 297 owner(), installer(), base::Closure(), false, message);
294 owner()->ReplaceInfoBar(this, delegate); 298 owner()->ReplaceInfoBar(this, delegate);
295 } 299 }
296 300
297 // PluginInstallerInfoBarDelegate --------------------------------------------- 301 // PluginInstallerInfoBarDelegate ---------------------------------------------
298 302
299 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( 303 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate(
300 InfoBarTabHelper* infobar_helper, 304 InfoBarTabService* infobar_service,
301 PluginInstaller* installer, 305 PluginInstaller* installer,
302 const base::Closure& callback, 306 const base::Closure& callback,
303 bool new_install, 307 bool new_install,
304 const string16& message) 308 const string16& message)
305 : ConfirmInfoBarDelegate(infobar_helper), 309 : ConfirmInfoBarDelegate(infobar_service),
306 WeakPluginInstallerObserver(installer), 310 WeakPluginInstallerObserver(installer),
307 callback_(callback), 311 callback_(callback),
308 new_install_(new_install), 312 new_install_(new_install),
309 message_(message) { 313 message_(message) {
310 } 314 }
311 315
312 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { 316 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() {
313 } 317 }
314 318
315 InfoBarDelegate* PluginInstallerInfoBarDelegate::Create( 319 InfoBarDelegate* PluginInstallerInfoBarDelegate::Create(
316 InfoBarTabHelper* infobar_helper, 320 InfoBarTabService* infobar_service,
317 PluginInstaller* installer, 321 PluginInstaller* installer,
318 const base::Closure& callback) { 322 const base::Closure& callback) {
319 string16 message; 323 string16 message;
320 const string16& plugin_name = installer->name(); 324 const string16& plugin_name = installer->name();
321 switch (installer->state()) { 325 switch (installer->state()) {
322 case PluginInstaller::INSTALLER_STATE_IDLE: 326 case PluginInstaller::INSTALLER_STATE_IDLE:
323 message = l10n_util::GetStringFUTF16( 327 message = l10n_util::GetStringFUTF16(
324 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT, plugin_name); 328 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT, plugin_name);
325 break; 329 break;
326 case PluginInstaller::INSTALLER_STATE_DOWNLOADING: 330 case PluginInstaller::INSTALLER_STATE_DOWNLOADING:
327 message = l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, plugin_name); 331 message = l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, plugin_name);
328 break; 332 break;
329 } 333 }
330 return new PluginInstallerInfoBarDelegate( 334 return new PluginInstallerInfoBarDelegate(
331 infobar_helper, installer, callback, true, message); 335 infobar_service, installer, callback, true, message);
332 } 336 }
333 337
334 gfx::Image* PluginInstallerInfoBarDelegate::GetIcon() const { 338 gfx::Image* PluginInstallerInfoBarDelegate::GetIcon() const {
335 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 339 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
336 IDR_INFOBAR_PLUGIN_INSTALL); 340 IDR_INFOBAR_PLUGIN_INSTALL);
337 } 341 }
338 342
339 string16 PluginInstallerInfoBarDelegate::GetMessageText() const { 343 string16 PluginInstallerInfoBarDelegate::GetMessageText() const {
340 return message_; 344 return message_;
341 } 345 }
(...skipping 24 matching lines...) Expand all
366 GURL url(installer()->help_url()); 370 GURL url(installer()->help_url());
367 if (url.is_empty()) { 371 if (url.is_empty()) {
368 url = google_util::AppendGoogleLocaleParam(GURL( 372 url = google_util::AppendGoogleLocaleParam(GURL(
369 "https://www.google.com/support/chrome/bin/answer.py?answer=142064")); 373 "https://www.google.com/support/chrome/bin/answer.py?answer=142064"));
370 } 374 }
371 375
372 OpenURLParams params( 376 OpenURLParams params(
373 url, Referrer(), 377 url, Referrer(),
374 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 378 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
375 content::PAGE_TRANSITION_LINK, false); 379 content::PAGE_TRANSITION_LINK, false);
376 owner()->web_contents()->OpenURL(params); 380 owner()->GetWebContents()->OpenURL(params);
377 return false; 381 return false;
378 } 382 }
379 383
380 void PluginInstallerInfoBarDelegate::DownloadStarted() { 384 void PluginInstallerInfoBarDelegate::DownloadStarted() {
381 ReplaceWithInfoBar(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, 385 ReplaceWithInfoBar(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING,
382 installer()->name())); 386 installer()->name()));
383 } 387 }
384 388
385 void PluginInstallerInfoBarDelegate::DownloadCancelled() { 389 void PluginInstallerInfoBarDelegate::DownloadCancelled() {
386 ReplaceWithInfoBar(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_CANCELLED, 390 ReplaceWithInfoBar(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_CANCELLED,
(...skipping 27 matching lines...) Expand all
414 if (!owner()) 418 if (!owner())
415 return; 419 return;
416 InfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate( 420 InfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate(
417 owner(), installer(), base::Closure(), new_install_, message); 421 owner(), installer(), base::Closure(), new_install_, message);
418 owner()->ReplaceInfoBar(this, delegate); 422 owner()->ReplaceInfoBar(this, delegate);
419 } 423 }
420 424
421 // PluginMetroModeInfoBarDelegate --------------------------------------------- 425 // PluginMetroModeInfoBarDelegate ---------------------------------------------
422 #if defined(OS_WIN) 426 #if defined(OS_WIN)
423 InfoBarDelegate* PluginMetroModeInfoBarDelegate::Create( 427 InfoBarDelegate* PluginMetroModeInfoBarDelegate::Create(
424 InfoBarTabHelper* infobar_helper, const string16& plugin_name) { 428 InfoBarTabService* infobar_service, const string16& plugin_name) {
425 string16 message = l10n_util::GetStringFUTF16( 429 string16 message = l10n_util::GetStringFUTF16(
426 IDS_METRO_MISSING_PLUGIN_PROMPT, plugin_name); 430 IDS_METRO_MISSING_PLUGIN_PROMPT, plugin_name);
427 return new PluginMetroModeInfoBarDelegate( 431 return new PluginMetroModeInfoBarDelegate(
428 infobar_helper, message); 432 infobar_service, message);
429 } 433 }
430 434
431 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( 435 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate(
432 InfoBarTabHelper* infobar_helper, const string16& message) 436 InfoBarTabService* infobar_service, const string16& message)
433 : ConfirmInfoBarDelegate(infobar_helper), 437 : ConfirmInfoBarDelegate(infobar_service),
434 message_(message) { 438 message_(message) {
435 } 439 }
436 440
437 PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() { 441 PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() {
438 } 442 }
439 443
440 gfx::Image* PluginMetroModeInfoBarDelegate::GetIcon() const { 444 gfx::Image* PluginMetroModeInfoBarDelegate::GetIcon() const {
441 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 445 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
442 IDR_INFOBAR_PLUGIN_INSTALL); 446 IDR_INFOBAR_PLUGIN_INSTALL);
443 } 447 }
444 448
445 string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { 449 string16 PluginMetroModeInfoBarDelegate::GetMessageText() const {
446 return message_; 450 return message_;
447 } 451 }
448 452
449 int PluginMetroModeInfoBarDelegate::GetButtons() const { 453 int PluginMetroModeInfoBarDelegate::GetButtons() const {
450 return BUTTON_OK; 454 return BUTTON_OK;
451 } 455 }
452 456
453 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( 457 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel(
454 InfoBarButton button) const { 458 InfoBarButton button) const {
455 DCHECK_EQ(BUTTON_OK, button); 459 DCHECK_EQ(BUTTON_OK, button);
456 return l10n_util::GetStringUTF16(IDS_METRO_SWITCH_TO_DESKTOP_BUTTON); 460 return l10n_util::GetStringUTF16(IDS_METRO_SWITCH_TO_DESKTOP_BUTTON);
457 } 461 }
458 462
459 bool PluginMetroModeInfoBarDelegate::Accept() { 463 bool PluginMetroModeInfoBarDelegate::Accept() {
460 content::WebContents* web_contents = owner()->web_contents(); 464 content::WebContents* web_contents = owner()->GetWebContents();
461 if (!web_contents) 465 if (!web_contents)
462 return false; 466 return false;
463 // Note that empty urls are not valid. 467 // Note that empty urls are not valid.
464 if (!web_contents->GetURL().is_valid()) 468 if (!web_contents->GetURL().is_valid())
465 return false; 469 return false;
466 std::string url(web_contents->GetURL().spec()); 470 std::string url(web_contents->GetURL().spec());
467 // This obscure use of the 'log usage' mask for windows 8 is documented 471 // This obscure use of the 'log usage' mask for windows 8 is documented
468 // here http://goo.gl/HBOe9. 472 // here http://goo.gl/HBOe9.
469 ui::win::OpenAnyViaShell(UTF8ToUTF16(url), 473 ui::win::OpenAnyViaShell(UTF8ToUTF16(url),
470 string16(), 474 string16(),
471 SEE_MASK_FLAG_LOG_USAGE); 475 SEE_MASK_FLAG_LOG_USAGE);
472 return true; 476 return true;
473 } 477 }
474 478
475 string16 PluginMetroModeInfoBarDelegate::GetLinkText() const { 479 string16 PluginMetroModeInfoBarDelegate::GetLinkText() const {
476 return l10n_util::GetStringUTF16(IDS_METRO_SWITCH_WHY_LINK); 480 return l10n_util::GetStringUTF16(IDS_METRO_SWITCH_WHY_LINK);
477 } 481 }
478 482
479 bool PluginMetroModeInfoBarDelegate::LinkClicked( 483 bool PluginMetroModeInfoBarDelegate::LinkClicked(
480 WindowOpenDisposition disposition) { 484 WindowOpenDisposition disposition) {
481 // TODO(cpu): replace with the final url. 485 // TODO(cpu): replace with the final url.
482 GURL url = google_util::AppendGoogleLocaleParam(GURL( 486 GURL url = google_util::AppendGoogleLocaleParam(GURL(
483 "https://support.google.com/chrome/?ib_display_in_desktop")); 487 "https://support.google.com/chrome/?ib_display_in_desktop"));
484 OpenURLParams params( 488 OpenURLParams params(
485 url, Referrer(), 489 url, Referrer(),
486 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 490 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
487 content::PAGE_TRANSITION_LINK, false); 491 content::PAGE_TRANSITION_LINK, false);
488 owner()->web_contents()->OpenURL(params); 492 owner()->GetWebContents()->OpenURL(params);
489 return false; 493 return false;
490 } 494 }
491 #endif // defined(OS_WIN) 495 #endif // defined(OS_WIN)
492 #endif // defined(ENABLE_PLUGIN_INSTALLATION) 496 #endif // defined(ENABLE_PLUGIN_INSTALLATION)
OLDNEW
« no previous file with comments | « chrome/browser/plugin_infobar_delegates.h ('k') | chrome/browser/tab_contents/tab_contents_ssl_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698