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

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

Issue 156843004: Remove ExtensionService::extension_prefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: additional cleanup Created 6 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 | Annotate | Revision Log
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" 7 #include "base/command_line.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.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/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/extensions/extension_constants.h" 13 #include "chrome/common/extensions/extension_constants.h"
13 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 14 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
14 #include "extensions/browser/extension_prefs.h" 15 #include "extensions/browser/extension_prefs.h"
15 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
16 17
17 #if defined(OS_WIN) 18 #if defined(OS_WIN)
18 #include "win8/util/win8_util.h" 19 #include "win8/util/win8_util.h"
19 #endif 20 #endif
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 int value = LAUNCH_TYPE_INVALID; 69 int value = LAUNCH_TYPE_INVALID;
69 return prefs->ReadPrefAsInteger(extension_id, kPrefLaunchType, &value) 70 return prefs->ReadPrefAsInteger(extension_id, kPrefLaunchType, &value)
70 ? static_cast<LaunchType>(value) : LAUNCH_TYPE_INVALID; 71 ? static_cast<LaunchType>(value) : LAUNCH_TYPE_INVALID;
71 } 72 }
72 73
73 void SetLaunchType(ExtensionService* service, 74 void SetLaunchType(ExtensionService* service,
74 const std::string& extension_id, 75 const std::string& extension_id,
75 LaunchType launch_type) { 76 LaunchType launch_type) {
76 DCHECK(launch_type >= LAUNCH_TYPE_FIRST && launch_type < NUM_LAUNCH_TYPES); 77 DCHECK(launch_type >= LAUNCH_TYPE_FIRST && launch_type < NUM_LAUNCH_TYPES);
77 78
78 service->extension_prefs()->UpdateExtensionPref(extension_id, kPrefLaunchType, 79 ExtensionPrefs::Get(service->profile())->
79 new base::FundamentalValue(static_cast<int>(launch_type))); 80 UpdateExtensionPref(extension_id, kPrefLaunchType,
81 new base::FundamentalValue(static_cast<int>(launch_type)));
80 82
81 // Sync the launch type. 83 // Sync the launch type.
82 const Extension* extension = service->GetInstalledExtension(extension_id); 84 const Extension* extension = service->GetInstalledExtension(extension_id);
83 if (extension) { 85 if (extension) {
84 ExtensionSyncService::Get(service->profile())-> 86 ExtensionSyncService::Get(service->profile())->
85 SyncExtensionChangeIfNeeded(*extension); 87 SyncExtensionChangeIfNeeded(*extension);
86 } 88 }
87 } 89 }
88 90
89 LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs, 91 LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, 144 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs,
143 const Extension* extension) { 145 const Extension* extension) {
144 int value = -1; 146 int value = -1;
145 LaunchContainer manifest_launch_container = 147 LaunchContainer manifest_launch_container =
146 AppLaunchInfo::GetLaunchContainer(extension); 148 AppLaunchInfo::GetLaunchContainer(extension);
147 return manifest_launch_container == LAUNCH_CONTAINER_TAB && 149 return manifest_launch_container == LAUNCH_CONTAINER_TAB &&
148 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); 150 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value);
149 } 151 }
150 152
151 } // namespace extensions 153 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698