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

Side by Side Diff: chrome/browser/extensions/launch_util.cc

Issue 489313002: Centralize command line checks for kEnableStreamlinedHostedApps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_util.cc ('k') | chrome/browser/extensions/tab_helper.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/extensions/launch_util.h" 5 #include "chrome/browser/extensions/launch_util.h"
6 6
7 #include "base/command_line.h"
8 #include "base/values.h" 7 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_sync_service.h" 9 #include "chrome/browser/extensions/extension_sync_service.h"
10 #include "chrome/browser/extensions/extension_util.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"
14 #include "chrome/common/extensions/extension_constants.h" 13 #include "chrome/common/extensions/extension_constants.h"
15 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 14 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
16 #include "components/pref_registry/pref_registry_syncable.h" 15 #include "components/pref_registry/pref_registry_syncable.h"
17 #include "extensions/browser/extension_prefs.h" 16 #include "extensions/browser/extension_prefs.h"
18 #include "extensions/browser/pref_names.h" 17 #include "extensions/browser/pref_names.h"
19 #include "extensions/common/extension.h" 18 #include "extensions/common/extension.h"
20 19
21 #if defined(USE_ASH) 20 #if defined(USE_ASH)
22 #include "ash/shell.h" 21 #include "ash/shell.h"
23 #endif 22 #endif
(...skipping 17 matching lines...) Expand all
41 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 40 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
42 } 41 }
43 42
44 } // namespace launch_util 43 } // namespace launch_util
45 44
46 LaunchType GetLaunchType(const ExtensionPrefs* prefs, 45 LaunchType GetLaunchType(const ExtensionPrefs* prefs,
47 const Extension* extension) { 46 const Extension* extension) {
48 LaunchType result = LAUNCH_TYPE_DEFAULT; 47 LaunchType result = LAUNCH_TYPE_DEFAULT;
49 48
50 // Launch hosted apps as windows by default for streamlined hosted apps. 49 // Launch hosted apps as windows by default for streamlined hosted apps.
51 if (CommandLine::ForCurrentProcess()-> 50 if (util::IsStreamlinedHostedAppsEnabled() &&
52 HasSwitch(switches::kEnableStreamlinedHostedApps) &&
53 extension->id() != extension_misc::kChromeAppId) { 51 extension->id() != extension_misc::kChromeAppId) {
54 result = LAUNCH_TYPE_WINDOW; 52 result = LAUNCH_TYPE_WINDOW;
55 } 53 }
56 54
57 int value = GetLaunchTypePrefValue(prefs, extension->id()); 55 int value = GetLaunchTypePrefValue(prefs, extension->id());
58 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES) 56 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES)
59 result = static_cast<LaunchType>(value); 57 result = static_cast<LaunchType>(value);
60 58
61 #if defined(OS_MACOSX) 59 #if defined(OS_MACOSX)
62 // App windows are not yet supported on mac. Pref sync could make 60 // App windows are not yet supported on mac. Pref sync could make
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, 148 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs,
151 const Extension* extension) { 149 const Extension* extension) {
152 int value = -1; 150 int value = -1;
153 LaunchContainer manifest_launch_container = 151 LaunchContainer manifest_launch_container =
154 AppLaunchInfo::GetLaunchContainer(extension); 152 AppLaunchInfo::GetLaunchContainer(extension);
155 return manifest_launch_container == LAUNCH_CONTAINER_TAB && 153 return manifest_launch_container == LAUNCH_CONTAINER_TAB &&
156 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); 154 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value);
157 } 155 }
158 156
159 } // namespace extensions 157 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_util.cc ('k') | chrome/browser/extensions/tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698