Chromium Code Reviews| 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/plugins/plugin_infobar_delegates.h" | 5 #include "chrome/browser/plugins/plugin_infobar_delegates.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.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" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 #if defined(ENABLE_PLUGIN_INSTALLATION) | 30 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 32 #include "base/win/metro.h" | 32 #include "base/win/metro.h" |
| 33 #endif | 33 #endif |
| 34 #include "chrome/browser/plugins/plugin_installer.h" | 34 #include "chrome/browser/plugins/plugin_installer.h" |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 38 #include <shellapi.h> | 38 #include <shellapi.h> |
| 39 #include "ui/base/win/shell.h" | 39 #include "ui/base/win/shell.h" |
| 40 | |
| 41 #if defined(USE_AURA) | |
| 42 #include "ui/aura/remote_root_window_host_win.h" | |
| 43 #endif | |
| 40 #endif | 44 #endif |
| 41 | 45 |
| 42 using content::UserMetricsAction; | 46 using content::UserMetricsAction; |
| 43 | 47 |
| 44 | 48 |
| 45 // PluginInfoBarDelegate ------------------------------------------------------ | 49 // PluginInfoBarDelegate ------------------------------------------------------ |
| 46 | 50 |
| 47 PluginInfoBarDelegate::PluginInfoBarDelegate(InfoBarService* infobar_service, | 51 PluginInfoBarDelegate::PluginInfoBarDelegate(InfoBarService* infobar_service, |
| 48 const std::string& identifier) | 52 const std::string& identifier) |
| 49 : ConfirmInfoBarDelegate(infobar_service), | 53 : ConfirmInfoBarDelegate(infobar_service), |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 if (button == BUTTON_CANCEL) | 488 if (button == BUTTON_CANCEL) |
| 485 return l10n_util::GetStringUTF16(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); | 489 return l10n_util::GetStringUTF16(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); |
| 486 return l10n_util::GetStringUTF16((mode_ == MISSING_PLUGIN) ? | 490 return l10n_util::GetStringUTF16((mode_ == MISSING_PLUGIN) ? |
| 487 IDS_WIN8_DESKTOP_RESTART : IDS_WIN8_RESTART); | 491 IDS_WIN8_DESKTOP_RESTART : IDS_WIN8_RESTART); |
| 488 } | 492 } |
| 489 | 493 |
| 490 void LaunchDesktopInstanceHelper(const string16& url) { | 494 void LaunchDesktopInstanceHelper(const string16& url) { |
| 491 base::FilePath exe_path; | 495 base::FilePath exe_path; |
| 492 if (!PathService::Get(base::FILE_EXE, &exe_path)) | 496 if (!PathService::Get(base::FILE_EXE, &exe_path)) |
| 493 return; | 497 return; |
| 494 base::FilePath shortcut_path( | 498 base::FilePath shortcut_path( |
|
sky
2013/08/30 17:06:56
nit: 4 space indent is correct here (meaning don't
zturner
2013/08/30 18:10:05
Done.
| |
| 495 ShellIntegration::GetStartMenuShortcut(exe_path)); | 499 ShellIntegration::GetStartMenuShortcut(exe_path)); |
| 496 | 500 |
| 497 SHELLEXECUTEINFO sei = { sizeof(sei) }; | 501 string16 shortcut = shortcut_path.AsUTF16Unsafe(); |
| 498 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; | 502 |
| 499 sei.nShow = SW_SHOWNORMAL; | 503 // Actually launching the process needs to happen in the metro viewer, |
| 500 sei.lpFile = shortcut_path.value().c_str(); | 504 // otherwise it won't automatically transition to desktop. So we have |
| 501 sei.lpDirectory = L""; | 505 // to send an IPC to the viewer to do the ShellExecute. |
| 502 sei.lpParameters = url.c_str(); | 506 aura::RemoteRootWindowHostWin::Instance()->HandleOpenURLOnDesktop( |
|
sky
2013/08/30 17:06:56
What about non-aura?
zturner
2013/08/30 17:14:44
This function is only used as a helper function fr
zturner
2013/08/30 18:10:06
Done.
| |
| 503 ShellExecuteEx(&sei); | 507 shortcut, url); |
| 504 } | 508 } |
| 505 | 509 |
| 506 bool PluginMetroModeInfoBarDelegate::Accept() { | 510 bool PluginMetroModeInfoBarDelegate::Accept() { |
| 507 #if defined(USE_AURA) && defined(USE_ASH) | 511 #if defined(USE_AURA) && defined(USE_ASH) |
| 508 // We need to PostTask as there is some IO involved. | 512 // We need to PostTask as there is some IO involved. |
| 509 content::BrowserThread::PostTask( | 513 content::BrowserThread::PostTask( |
| 510 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, | 514 content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, |
| 511 base::Bind(&LaunchDesktopInstanceHelper, | 515 base::Bind(&LaunchDesktopInstanceHelper, |
| 512 UTF8ToUTF16(web_contents()->GetURL().spec()))); | 516 UTF8ToUTF16(web_contents()->GetURL().spec()))); |
| 513 #else | 517 #else |
| 514 chrome::AttemptRestartWithModeSwitch(); | 518 chrome::AttemptRestartWithModeSwitch(); |
| 515 #endif | 519 #endif |
| 516 return true; | 520 return true; |
| 517 } | 521 } |
| 518 | 522 |
| 519 bool PluginMetroModeInfoBarDelegate::Cancel() { | 523 bool PluginMetroModeInfoBarDelegate::Cancel() { |
| 520 DCHECK_EQ(DESKTOP_MODE_REQUIRED, mode_); | 524 DCHECK_EQ(DESKTOP_MODE_REQUIRED, mode_); |
| 521 Profile::FromBrowserContext(web_contents()->GetBrowserContext())-> | 525 Profile::FromBrowserContext(web_contents()->GetBrowserContext())-> |
| 522 GetHostContentSettingsMap()->SetContentSetting( | 526 GetHostContentSettingsMap()->SetContentSetting( |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 539 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | 543 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), |
| 540 content::Referrer(), | 544 content::Referrer(), |
| 541 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 545 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 542 content::PAGE_TRANSITION_LINK, false)); | 546 content::PAGE_TRANSITION_LINK, false)); |
| 543 return false; | 547 return false; |
| 544 } | 548 } |
| 545 | 549 |
| 546 #endif // defined(OS_WIN) | 550 #endif // defined(OS_WIN) |
| 547 | 551 |
| 548 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 552 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |