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

Side by Side Diff: extensions/browser/api/runtime/runtime_api.cc

Issue 282103003: Moved IS_EPHEMERAL flag to extension prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up file header Created 6 years, 7 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 | « chrome/test/data/extensions/app_list/Preferences ('k') | extensions/browser/event_router.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/runtime/runtime_api.h" 5 #include "extensions/browser/api/runtime/runtime_api.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "base/version.h" 14 #include "base/version.h"
15 #include "chrome/browser/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
16 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
17 #include "content/public/browser/child_process_security_policy.h" 17 #include "content/public/browser/child_process_security_policy.h"
18 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/render_view_host.h" 20 #include "content/public/browser/render_view_host.h"
21 #include "extensions/browser/api/runtime/runtime_api_delegate.h" 21 #include "extensions/browser/api/runtime/runtime_api_delegate.h"
22 #include "extensions/browser/event_router.h" 22 #include "extensions/browser/event_router.h"
23 #include "extensions/browser/extension_host.h" 23 #include "extensions/browser/extension_host.h"
24 #include "extensions/browser/extension_prefs.h" 24 #include "extensions/browser/extension_prefs.h"
25 #include "extensions/browser/extension_registry.h" 25 #include "extensions/browser/extension_registry.h"
26 #include "extensions/browser/extension_system.h" 26 #include "extensions/browser/extension_system.h"
27 #include "extensions/browser/extension_util.h"
27 #include "extensions/browser/extensions_browser_client.h" 28 #include "extensions/browser/extensions_browser_client.h"
28 #include "extensions/browser/lazy_background_task_queue.h" 29 #include "extensions/browser/lazy_background_task_queue.h"
29 #include "extensions/browser/process_manager.h" 30 #include "extensions/browser/process_manager.h"
30 #include "extensions/common/api/runtime.h" 31 #include "extensions/common/api/runtime.h"
31 #include "extensions/common/error_utils.h" 32 #include "extensions/common/error_utils.h"
32 #include "extensions/common/extension.h" 33 #include "extensions/common/extension.h"
33 #include "extensions/common/manifest_handlers/background_info.h" 34 #include "extensions/common/manifest_handlers/background_info.h"
34 #include "url/gurl.h" 35 #include "url/gurl.h"
35 #include "webkit/browser/fileapi/isolated_context.h" 36 #include "webkit/browser/fileapi/isolated_context.h"
36 37
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 base::Bind(&RuntimeEventRouter::DispatchOnInstalledEvent, 221 base::Bind(&RuntimeEventRouter::DispatchOnInstalledEvent,
221 browser_context_, 222 browser_context_,
222 extension->id(), 223 extension->id(),
223 Version(), 224 Version(),
224 true)); 225 true));
225 } 226 }
226 227
227 void RuntimeAPI::OnExtensionInstalled(const Extension* extension) { 228 void RuntimeAPI::OnExtensionInstalled(const Extension* extension) {
228 // Ephemeral apps are not considered to be installed and do not receive 229 // Ephemeral apps are not considered to be installed and do not receive
229 // the onInstalled() event. 230 // the onInstalled() event.
230 if (extension->is_ephemeral()) 231 if (util::IsEphemeralApp(extension->id(), browser_context_))
231 return; 232 return;
232 233
233 Version old_version = delegate_->GetPreviousExtensionVersion(extension); 234 Version old_version = delegate_->GetPreviousExtensionVersion(extension);
234 235
235 // Dispatch the onInstalled event. 236 // Dispatch the onInstalled event.
236 base::MessageLoop::current()->PostTask( 237 base::MessageLoop::current()->PostTask(
237 FROM_HERE, 238 FROM_HERE,
238 base::Bind(&RuntimeEventRouter::DispatchOnInstalledEvent, 239 base::Bind(&RuntimeEventRouter::DispatchOnInstalledEvent,
239 browser_context_, 240 browser_context_,
240 extension->id(), 241 extension->id(),
241 old_version, 242 old_version,
242 false)); 243 false));
243 } 244 }
244 245
245 void RuntimeAPI::OnExtensionUninstalled(const Extension* extension) { 246 void RuntimeAPI::OnExtensionUninstalled(const Extension* extension) {
246 // Ephemeral apps are not considered to be installed, so the uninstall URL 247 // Ephemeral apps are not considered to be installed, so the uninstall URL
247 // is not invoked when they are removed. 248 // is not invoked when they are removed.
248 if (extension->is_ephemeral()) 249 if (util::IsEphemeralApp(extension->id(), browser_context_))
249 return; 250 return;
250 251
251 RuntimeEventRouter::OnExtensionUninstalled(browser_context_, extension->id()); 252 RuntimeEventRouter::OnExtensionUninstalled(browser_context_, extension->id());
252 } 253 }
253 254
254 void RuntimeAPI::Shutdown() { 255 void RuntimeAPI::Shutdown() {
255 // ExtensionSystem deletes its ProcessManager during the Shutdown() phase, so 256 // ExtensionSystem deletes its ProcessManager during the Shutdown() phase, so
256 // the observer must be removed here and not in the RuntimeAPI destructor. 257 // the observer must be removed here and not in the RuntimeAPI destructor.
257 ProcessManager* process_manager = 258 ProcessManager* process_manager =
258 ExtensionSystem::Get(browser_context_)->process_manager(); 259 ExtensionSystem::Get(browser_context_)->process_manager();
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 content::ChildProcessSecurityPolicy* policy = 509 content::ChildProcessSecurityPolicy* policy =
509 content::ChildProcessSecurityPolicy::GetInstance(); 510 content::ChildProcessSecurityPolicy::GetInstance();
510 policy->GrantReadFileSystem(renderer_id, filesystem_id); 511 policy->GrantReadFileSystem(renderer_id, filesystem_id);
511 base::DictionaryValue* dict = new base::DictionaryValue(); 512 base::DictionaryValue* dict = new base::DictionaryValue();
512 dict->SetString("fileSystemId", filesystem_id); 513 dict->SetString("fileSystemId", filesystem_id);
513 dict->SetString("baseName", relative_path); 514 dict->SetString("baseName", relative_path);
514 return RespondNow(SingleArgument(dict)); 515 return RespondNow(SingleArgument(dict));
515 } 516 }
516 517
517 } // namespace extensions 518 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/app_list/Preferences ('k') | extensions/browser/event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698