| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/host_desktop.h" | 12 #include "chrome/browser/ui/host_desktop.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "extensions/browser/app_window/app_window.h" | 14 #include "extensions/browser/app_window/app_window.h" |
| 15 #include "extensions/browser/app_window/app_window_registry.h" | 15 #include "extensions/browser/app_window/app_window_registry.h" |
| 16 #include "extensions/common/constants.h" | 16 #include "extensions/common/constants.h" |
| 17 #include "ui/aura/remote_window_tree_host_win.h" | 17 #include "ui/aura/remote_window_tree_host_win.h" |
| 18 #include "ui/gfx/host_desktop_type.h" |
| 18 | 19 |
| 19 bool ChromeLauncherController::LaunchedInNativeDesktop( | 20 bool ChromeLauncherController::LaunchedInNativeDesktop( |
| 20 const std::string& app_id) { | 21 const std::string& app_id) { |
| 21 // If an app has any existing windows on the native desktop, funnel the | 22 // If an app has any existing windows on the native desktop, funnel the |
| 22 // launch request through the viewer process to desktop Chrome. This allows | 23 // launch request through the viewer process to desktop Chrome. This allows |
| 23 // Ash to relinquish foreground window status and trigger a switch to | 24 // Ash to relinquish foreground window status and trigger a switch to |
| 24 // desktop mode. | 25 // desktop mode. |
| 25 extensions::AppWindow* any_existing_window = | 26 extensions::AppWindow* any_existing_window = |
| 26 extensions::AppWindowRegistry::Get(profile()) | 27 extensions::AppWindowRegistry::Get(profile()) |
| 27 ->GetCurrentAppWindowForApp(app_id); | 28 ->GetCurrentAppWindowForApp(app_id); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 41 // for the app in the current Profile. | 42 // for the app in the current Profile. |
| 42 std::string spec = base::StringPrintf("\"--%s=%s\" \"--%s=%s\"", | 43 std::string spec = base::StringPrintf("\"--%s=%s\" \"--%s=%s\"", |
| 43 switches::kProfileDirectory, | 44 switches::kProfileDirectory, |
| 44 profile_->GetPath().BaseName().AsUTF8Unsafe().c_str(), | 45 profile_->GetPath().BaseName().AsUTF8Unsafe().c_str(), |
| 45 switches::kAppId, | 46 switches::kAppId, |
| 46 app_id.c_str()); | 47 app_id.c_str()); |
| 47 aura::RemoteWindowTreeHostWin::Instance()->HandleOpenURLOnDesktop( | 48 aura::RemoteWindowTreeHostWin::Instance()->HandleOpenURLOnDesktop( |
| 48 exe_path, base::UTF8ToUTF16(spec)); | 49 exe_path, base::UTF8ToUTF16(spec)); |
| 49 return true; | 50 return true; |
| 50 } | 51 } |
| OLD | NEW |