| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 70 } |
| 70 | 71 |
| 71 } // namespace | 72 } // namespace |
| 72 | 73 |
| 73 namespace application_launch { | 74 namespace application_launch { |
| 74 | 75 |
| 75 WebContents* OpenApplication(Profile* profile, | 76 WebContents* OpenApplication(Profile* profile, |
| 76 const Extension* extension, | 77 const Extension* extension, |
| 77 extension_misc::LaunchContainer container, | 78 extension_misc::LaunchContainer container, |
| 78 const GURL& override_url, | 79 const GURL& override_url, |
| 79 WindowOpenDisposition disposition) { | 80 WindowOpenDisposition disposition, |
| 81 const CommandLine* command_line) { |
| 80 WebContents* tab = NULL; | 82 WebContents* tab = NULL; |
| 81 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); | 83 ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); |
| 82 prefs->SetActiveBit(extension->id(), true); | 84 prefs->SetActiveBit(extension->id(), true); |
| 83 | 85 |
| 84 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); | 86 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunchContainer", container, 100); |
| 85 | 87 |
| 86 if (extension->is_platform_app()) { | 88 if (extension->is_platform_app()) { |
| 87 extensions::AppEventRouter::DispatchOnLaunchedEvent(profile, extension); | 89 extensions::LaunchPlatformApp(profile, extension, command_line); |
| 88 return NULL; | 90 return NULL; |
| 89 } | 91 } |
| 90 | 92 |
| 91 switch (container) { | 93 switch (container) { |
| 92 case extension_misc::LAUNCH_NONE: { | 94 case extension_misc::LAUNCH_NONE: { |
| 93 NOTREACHED(); | 95 NOTREACHED(); |
| 94 break; | 96 break; |
| 95 } | 97 } |
| 96 case extension_misc::LAUNCH_PANEL: | 98 case extension_misc::LAUNCH_PANEL: |
| 97 #if defined(USE_ASH) | 99 #if defined(USE_ASH) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && | 318 if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN && |
| 317 !browser->window()->IsFullscreen()) { | 319 !browser->window()->IsFullscreen()) { |
| 318 browser->ToggleFullscreenMode(); | 320 browser->ToggleFullscreenMode(); |
| 319 } | 321 } |
| 320 #endif | 322 #endif |
| 321 | 323 |
| 322 return contents; | 324 return contents; |
| 323 } | 325 } |
| 324 | 326 |
| 325 } // namespace application_launch | 327 } // namespace application_launch |
| OLD | NEW |