| OLD | NEW |
| 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_service.h" | 8 #include "chrome/browser/api/infobars/infobar_service.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/google/google_util.h" | 10 #include "chrome/browser/google/google_util.h" |
| 11 #include "chrome/browser/lifetime/application_lifetime.h" |
| 11 #include "chrome/browser/plugin_observer.h" | 12 #include "chrome/browser/plugin_observer.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 13 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
| 14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 15 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "grit/locale_settings.h" | 20 #include "grit/locale_settings.h" |
| 20 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 return message_; | 449 return message_; |
| 449 } | 450 } |
| 450 | 451 |
| 451 int PluginMetroModeInfoBarDelegate::GetButtons() const { | 452 int PluginMetroModeInfoBarDelegate::GetButtons() const { |
| 452 return BUTTON_OK; | 453 return BUTTON_OK; |
| 453 } | 454 } |
| 454 | 455 |
| 455 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( | 456 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( |
| 456 InfoBarButton button) const { | 457 InfoBarButton button) const { |
| 457 DCHECK_EQ(BUTTON_OK, button); | 458 DCHECK_EQ(BUTTON_OK, button); |
| 458 return l10n_util::GetStringUTF16(IDS_METRO_SWITCH_TO_DESKTOP_BUTTON); | 459 return l10n_util::GetStringUTF16(IDS_WIN8_DESKTOP_RESTART); |
| 459 } | 460 } |
| 460 | 461 |
| 461 bool PluginMetroModeInfoBarDelegate::Accept() { | 462 bool PluginMetroModeInfoBarDelegate::Accept() { |
| 462 content::WebContents* web_contents = owner()->GetWebContents(); | 463 content::WebContents* web_contents = owner()->GetWebContents(); |
| 463 if (!web_contents) | 464 if (!web_contents) |
| 464 return false; | 465 return false; |
| 465 // Note that empty urls are not valid. | 466 // Note that empty urls are not valid. |
| 466 if (!web_contents->GetURL().is_valid()) | 467 if (!web_contents->GetURL().is_valid()) |
| 467 return false; | 468 return false; |
| 468 std::string url(web_contents->GetURL().spec()); | 469 std::string url(web_contents->GetURL().spec()); |
| 469 // This obscure use of the 'log usage' mask for windows 8 is documented | 470 browser::AttemptRestartWithModeSwitch(); |
| 470 // here http://goo.gl/HBOe9. | |
| 471 ui::win::OpenAnyViaShell(UTF8ToUTF16(url), | |
| 472 string16(), | |
| 473 SEE_MASK_FLAG_LOG_USAGE); | |
| 474 return true; | 471 return true; |
| 475 } | 472 } |
| 476 | 473 |
| 477 string16 PluginMetroModeInfoBarDelegate::GetLinkText() const { | 474 string16 PluginMetroModeInfoBarDelegate::GetLinkText() const { |
| 478 return l10n_util::GetStringUTF16(IDS_METRO_SWITCH_WHY_LINK); | 475 return l10n_util::GetStringUTF16(IDS_METRO_SWITCH_WHY_LINK); |
| 479 } | 476 } |
| 480 | 477 |
| 481 bool PluginMetroModeInfoBarDelegate::LinkClicked( | 478 bool PluginMetroModeInfoBarDelegate::LinkClicked( |
| 482 WindowOpenDisposition disposition) { | 479 WindowOpenDisposition disposition) { |
| 483 // TODO(cpu): replace with the final url. | 480 // TODO(cpu): replace with the final url. |
| 484 GURL url = google_util::AppendGoogleLocaleParam(GURL( | 481 GURL url = google_util::AppendGoogleLocaleParam(GURL( |
| 485 "https://support.google.com/chrome/?ib_display_in_desktop")); | 482 "https://support.google.com/chrome/?ib_display_in_desktop")); |
| 486 OpenURLParams params( | 483 OpenURLParams params( |
| 487 url, Referrer(), | 484 url, Referrer(), |
| 488 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 485 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 489 content::PAGE_TRANSITION_LINK, false); | 486 content::PAGE_TRANSITION_LINK, false); |
| 490 owner()->GetWebContents()->OpenURL(params); | 487 owner()->GetWebContents()->OpenURL(params); |
| 491 return false; | 488 return false; |
| 492 } | 489 } |
| 493 #endif // defined(OS_WIN) | 490 #endif // defined(OS_WIN) |
| 494 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 491 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |