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

Side by Side Diff: chrome/browser/extensions/api/app_runtime/app_runtime_api.cc

Issue 156843004: Remove ExtensionService::extension_prefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix UserScriptListenerTests.MultiProfile 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) 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/extensions/api/app_runtime/app_runtime_api.h" 5 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" 13 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/extensions/api/app_runtime.h" 15 #include "chrome/common/extensions/api/app_runtime.h"
17 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
18 #include "extensions/browser/event_router.h" 17 #include "extensions/browser/event_router.h"
19 #include "extensions/browser/extension_prefs.h" 18 #include "extensions/browser/extension_prefs.h"
20 #include "extensions/browser/extension_system.h" 19 #include "extensions/browser/extension_system.h"
21 #include "extensions/common/extension.h" 20 #include "extensions/common/extension.h"
22 #include "url/gurl.h" 21 #include "url/gurl.h"
23 22
24 #if defined(OS_CHROMEOS) 23 #if defined(OS_CHROMEOS)
(...skipping 18 matching lines...) Expand all
43 scoped_ptr<base::ListValue> args(new base::ListValue()); 42 scoped_ptr<base::ListValue> args(new base::ListValue());
44 args->Append(launch_data.release()); 43 args->Append(launch_data.release());
45 extensions::ExtensionSystem* system = 44 extensions::ExtensionSystem* system =
46 extensions::ExtensionSystem::Get(profile); 45 extensions::ExtensionSystem::Get(profile);
47 scoped_ptr<Event> event(new Event(app_runtime::OnLaunched::kEventName, 46 scoped_ptr<Event> event(new Event(app_runtime::OnLaunched::kEventName,
48 args.Pass())); 47 args.Pass()));
49 event->restrict_to_browser_context = profile; 48 event->restrict_to_browser_context = profile;
50 event->can_load_ephemeral_apps = true; 49 event->can_load_ephemeral_apps = true;
51 system->event_router()->DispatchEventWithLazyListener(extension_id, 50 system->event_router()->DispatchEventWithLazyListener(extension_id,
52 event.Pass()); 51 event.Pass());
53 system->extension_service()->extension_prefs()->SetLastLaunchTime( 52 ExtensionPrefs::Get(profile)
54 extension_id, base::Time::Now()); 53 ->SetLastLaunchTime(extension_id, base::Time::Now());
55 } 54 }
56 55
57 } // anonymous namespace 56 } // anonymous namespace
58 57
59 // static. 58 // static.
60 void AppEventRouter::DispatchOnLaunchedEvent( 59 void AppEventRouter::DispatchOnLaunchedEvent(
61 Profile* profile, const Extension* extension) { 60 Profile* profile, const Extension* extension) {
62 scoped_ptr<base::DictionaryValue> launch_data(new base::DictionaryValue()); 61 scoped_ptr<base::DictionaryValue> launch_data(new base::DictionaryValue());
63 DispatchOnLaunchedEventImpl(extension->id(), launch_data.Pass(), profile); 62 DispatchOnLaunchedEventImpl(extension->id(), launch_data.Pass(), profile);
64 } 63 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 const GURL& referrer_url) { 103 const GURL& referrer_url) {
105 api::app_runtime::LaunchData launch_data; 104 api::app_runtime::LaunchData launch_data;
106 launch_data.id.reset(new std::string(handler_id)); 105 launch_data.id.reset(new std::string(handler_id));
107 launch_data.url.reset(new std::string(url.spec())); 106 launch_data.url.reset(new std::string(url.spec()));
108 launch_data.referrer_url.reset(new std::string(referrer_url.spec())); 107 launch_data.referrer_url.reset(new std::string(referrer_url.spec()));
109 DispatchOnLaunchedEventImpl( 108 DispatchOnLaunchedEventImpl(
110 extension->id(), launch_data.ToValue().Pass(), profile); 109 extension->id(), launch_data.ToValue().Pass(), profile);
111 } 110 }
112 111
113 } // namespace extensions 112 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/download/download_crx_util.cc ('k') | chrome/browser/extensions/api/commands/command_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698