| 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/ui/extensions/application_launch.h" | 5 #include "chrome/browser/ui/extensions/application_launch.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 8 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/extensions/api/app/app_api.h" | |
| 10 #include "chrome/browser/extensions/default_apps_trial.h" | 10 #include "chrome/browser/extensions/default_apps_trial.h" |
| 11 #include "chrome/browser/extensions/extension_prefs.h" | 11 #include "chrome/browser/extensions/extension_prefs.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_tab_helper.h" | 13 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 14 #include "chrome/browser/extensions/platform_app_launcher.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/panels/panel_manager.h" | 20 #include "chrome/browser/ui/panels/panel_manager.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 21 #include "chrome/browser/web_applications/web_app.h" | 22 #include "chrome/browser/web_applications/web_app.h" |
| 22 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | 24 #include "chrome/common/extensions/extension_constants.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 75 } |
| 75 | 76 |
| 76 } // namespace | 77 } // namespace |
| 77 | 78 |
| 78 namespace application_launch { | 79 namespace application_launch { |
| 79 | 80 |
| 80 WebContents* OpenApplication(Profile* profile, | 81 WebContents* OpenApplication(Profile* profile, |
| 81 const Extension* extension, | 82 const Extension* extension, |
| 82 extension_misc::LaunchContainer container, | 83 extension_misc::LaunchContainer container, |
| 83 const GURL& override_url, | 84 const GURL& override_url, |
| 84 WindowOpenDisposition disposition) { | 85 WindowOpenDisposition disposition, |
| 86 const CommandLine* command_line) { |
| 85 WebContents* tab = NULL; | 87 WebContents* tab = NULL; |
| 86 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); | 88 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); |
| 87 prefs->SetActiveBit(extension->id(), true); | 89 prefs->SetActiveBit(extension->id(), true); |
| 88 | 90 |
| 89 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); | 91 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); |
| 90 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
| 91 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) | 93 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) |
| 92 chromeos::KioskModeMetrics::Get()->UserOpenedApp(); | 94 chromeos::KioskModeMetrics::Get()->UserOpenedApp(); |
| 93 #endif | 95 #endif |
| 94 | 96 |
| 95 if (extension->is_platform_app()) { | 97 if (extension->is_platform_app()) { |
| 96 extensions::AppEventRouter::DispatchOnLaunchedEvent(profile, extension); | 98 extensions::LaunchPlatformApp(profile, extension, command_line); |
| 97 return NULL; | 99 return NULL; |
| 98 } | 100 } |
| 99 | 101 |
| 100 switch (container) { | 102 switch (container) { |
| 101 case extension_misc::LAUNCH_NONE: { | 103 case extension_misc::LAUNCH_NONE: { |
| 102 NOTREACHED(); | 104 NOTREACHED(); |
| 103 break; | 105 break; |
| 104 } | 106 } |
| 105 case extension_misc::LAUNCH_PANEL: | 107 case extension_misc::LAUNCH_PANEL: |
| 106 #if defined(USE_ASH) | 108 #if defined(USE_ASH) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && | 327 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && |
| 326 !browser->window()->IsFullscreen()) { | 328 !browser->window()->IsFullscreen()) { |
| 327 browser->ToggleFullscreenMode(); | 329 browser->ToggleFullscreenMode(); |
| 328 } | 330 } |
| 329 #endif | 331 #endif |
| 330 | 332 |
| 331 return contents; | 333 return contents; |
| 332 } | 334 } |
| 333 | 335 |
| 334 } // namespace application_launch | 336 } // namespace application_launch |
| OLD | NEW |