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

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

Issue 23592024: Make the metro viewer responsible for relaunching browser in desktop mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a few nits. Created 7 years, 3 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
« no previous file with comments | « no previous file | ui/aura/remote_root_window_host_win.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 "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
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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 484 }
481 485
482 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel( 486 string16 PluginMetroModeInfoBarDelegate::GetButtonLabel(
483 InfoBarButton button) const { 487 InfoBarButton button) const {
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
494 #if defined(USE_AURA) && defined(USE_ASH)
490 void LaunchDesktopInstanceHelper(const string16& url) { 495 void LaunchDesktopInstanceHelper(const string16& url) {
491 base::FilePath exe_path; 496 base::FilePath exe_path;
492 if (!PathService::Get(base::FILE_EXE, &exe_path)) 497 if (!PathService::Get(base::FILE_EXE, &exe_path))
493 return; 498 return;
494 base::FilePath shortcut_path( 499 base::FilePath shortcut_path(
495 ShellIntegration::GetStartMenuShortcut(exe_path)); 500 ShellIntegration::GetStartMenuShortcut(exe_path));
496 501
497 SHELLEXECUTEINFO sei = { sizeof(sei) }; 502 // Actually launching the process needs to happen in the metro viewer,
498 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; 503 // otherwise it won't automatically transition to desktop. So we have
499 sei.nShow = SW_SHOWNORMAL; 504 // to send an IPC to the viewer to do the ShellExecute.
500 sei.lpFile = shortcut_path.value().c_str(); 505 aura::RemoteRootWindowHostWin::Instance()->HandleOpenURLOnDesktop(
501 sei.lpDirectory = L""; 506 shortcut_path, url);
502 sei.lpParameters = url.c_str();
503 ShellExecuteEx(&sei);
504 } 507 }
508 #endif
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
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)
OLDNEW
« no previous file with comments | « no previous file | ui/aura/remote_root_window_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698