OLD | NEW |
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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 event->restrict_to_profile = profile; | 41 event->restrict_to_profile = profile; |
42 system->event_router()->DispatchEventToExtension(extension_id, event.Pass()); | 42 system->event_router()->DispatchEventToExtension(extension_id, event.Pass()); |
43 system->event_router()->RemoveLazyEventListener(kOnLaunched, extension_id); | 43 system->event_router()->RemoveLazyEventListener(kOnLaunched, extension_id); |
44 } | 44 } |
45 | 45 |
46 } // anonymous namespace | 46 } // anonymous namespace |
47 | 47 |
48 // static. | 48 // static. |
49 void AppEventRouter::DispatchOnLaunchedEvent( | 49 void AppEventRouter::DispatchOnLaunchedEvent( |
50 Profile* profile, const Extension* extension) { | 50 Profile* profile, const Extension* extension) { |
51 scoped_ptr<ListValue> arguments(new ListValue()); | 51 scoped_ptr<base::ListValue> arguments(new base::ListValue()); |
52 DispatchOnLaunchedEventImpl(extension->id(), arguments.Pass(), profile); | 52 DispatchOnLaunchedEventImpl(extension->id(), arguments.Pass(), profile); |
53 } | 53 } |
54 | 54 |
55 // static. | 55 // static. |
56 void AppEventRouter::DispatchOnRestartedEvent(Profile* profile, | 56 void AppEventRouter::DispatchOnRestartedEvent(Profile* profile, |
57 const Extension* extension) { | 57 const Extension* extension) { |
58 scoped_ptr<ListValue> arguments(new ListValue()); | 58 scoped_ptr<base::ListValue> arguments(new base::ListValue()); |
59 scoped_ptr<Event> event(new Event(kOnRestarted, arguments.Pass())); | 59 scoped_ptr<Event> event(new Event(kOnRestarted, arguments.Pass())); |
60 event->restrict_to_profile = profile; | 60 event->restrict_to_profile = profile; |
61 extensions::ExtensionSystem::Get(profile)->event_router()-> | 61 extensions::ExtensionSystem::Get(profile)->event_router()-> |
62 DispatchEventToExtension(extension->id(), event.Pass()); | 62 DispatchEventToExtension(extension->id(), event.Pass()); |
63 } | 63 } |
64 | 64 |
65 // static. | 65 // static. |
66 void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( | 66 void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
67 Profile* profile, const Extension* extension, | 67 Profile* profile, const Extension* extension, |
68 const std::string& handler_id, const std::string& mime_type, | 68 const std::string& handler_id, const std::string& mime_type, |
69 const extensions::app_file_handler_util::GrantedFileEntry& file_entry) { | 69 const extensions::app_file_handler_util::GrantedFileEntry& file_entry) { |
70 scoped_ptr<ListValue> args(new ListValue()); | 70 scoped_ptr<base::ListValue> args(new base::ListValue()); |
71 DictionaryValue* launch_data = new DictionaryValue(); | 71 base::DictionaryValue* launch_data = new base::DictionaryValue(); |
72 launch_data->SetString("id", handler_id); | 72 launch_data->SetString("id", handler_id); |
73 DictionaryValue* launch_item = new DictionaryValue; | 73 base::DictionaryValue* launch_item = new base::DictionaryValue; |
74 launch_item->SetString("fileSystemId", file_entry.filesystem_id); | 74 launch_item->SetString("fileSystemId", file_entry.filesystem_id); |
75 launch_item->SetString("baseName", file_entry.registered_name); | 75 launch_item->SetString("baseName", file_entry.registered_name); |
76 launch_item->SetString("mimeType", mime_type); | 76 launch_item->SetString("mimeType", mime_type); |
77 launch_item->SetString("entryId", file_entry.id); | 77 launch_item->SetString("entryId", file_entry.id); |
78 ListValue* items = new ListValue; | 78 base::ListValue* items = new base::ListValue; |
79 items->Append(launch_item); | 79 items->Append(launch_item); |
80 launch_data->Set("items", items); | 80 launch_data->Set("items", items); |
81 args->Append(launch_data); | 81 args->Append(launch_data); |
82 DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile); | 82 DispatchOnLaunchedEventImpl(extension->id(), args.Pass(), profile); |
83 } | 83 } |
84 | 84 |
85 } // namespace extensions | 85 } // namespace extensions |
OLD | NEW |