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

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

Issue 921103003: [Mac] Always launch in tab if bookmark apps are disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use IsNewBookmarkAppsEnabled Created 5 years, 10 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 | no next file » | 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/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/extension_sync_service.h" 8 #include "chrome/browser/extensions/extension_sync_service.h"
9 #include "chrome/browser/extensions/extension_util.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/host_desktop.h" 11 #include "chrome/browser/ui/host_desktop.h"
11 #include "chrome/common/extensions/extension_constants.h" 12 #include "chrome/common/extensions/extension_constants.h"
12 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 13 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 14 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "extensions/browser/extension_prefs.h" 15 #include "extensions/browser/extension_prefs.h"
15 #include "extensions/browser/extension_registry.h" 16 #include "extensions/browser/extension_registry.h"
16 #include "extensions/browser/pref_names.h" 17 #include "extensions/browser/pref_names.h"
17 #include "extensions/common/extension.h" 18 #include "extensions/common/extension.h"
18 19
(...skipping 23 matching lines...) Expand all
42 } // namespace launch_util 43 } // namespace launch_util
43 44
44 LaunchType GetLaunchType(const ExtensionPrefs* prefs, 45 LaunchType GetLaunchType(const ExtensionPrefs* prefs,
45 const Extension* extension) { 46 const Extension* extension) {
46 LaunchType result = LAUNCH_TYPE_DEFAULT; 47 LaunchType result = LAUNCH_TYPE_DEFAULT;
47 48
48 int value = GetLaunchTypePrefValue(prefs, extension->id()); 49 int value = GetLaunchTypePrefValue(prefs, extension->id());
49 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES) 50 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES)
50 result = static_cast<LaunchType>(value); 51 result = static_cast<LaunchType>(value);
51 52
53 #if defined(OS_MACOSX)
54 // On Mac, opening in a window is only supported if bookmark apps are enabled.
55 if (!extensions::util::IsNewBookmarkAppsEnabled() &&
56 !extension->is_platform_app() && result == LAUNCH_TYPE_WINDOW)
57 result = LAUNCH_TYPE_REGULAR;
58 #endif
59
52 return result; 60 return result;
53 } 61 }
54 62
55 LaunchType GetLaunchTypePrefValue(const ExtensionPrefs* prefs, 63 LaunchType GetLaunchTypePrefValue(const ExtensionPrefs* prefs,
56 const std::string& extension_id) { 64 const std::string& extension_id) {
57 int value = LAUNCH_TYPE_INVALID; 65 int value = LAUNCH_TYPE_INVALID;
58 return prefs->ReadPrefAsInteger(extension_id, kPrefLaunchType, &value) 66 return prefs->ReadPrefAsInteger(extension_id, kPrefLaunchType, &value)
59 ? static_cast<LaunchType>(value) : LAUNCH_TYPE_INVALID; 67 ? static_cast<LaunchType>(value) : LAUNCH_TYPE_INVALID;
60 } 68 }
61 69
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, 140 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs,
133 const Extension* extension) { 141 const Extension* extension) {
134 int value = -1; 142 int value = -1;
135 LaunchContainer manifest_launch_container = 143 LaunchContainer manifest_launch_container =
136 AppLaunchInfo::GetLaunchContainer(extension); 144 AppLaunchInfo::GetLaunchContainer(extension);
137 return manifest_launch_container == LAUNCH_CONTAINER_TAB && 145 return manifest_launch_container == LAUNCH_CONTAINER_TAB &&
138 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); 146 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value);
139 } 147 }
140 148
141 } // namespace extensions 149 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698