| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 DispatchOnLaunchedEventImpl(extension->id(), launch_data.Pass(), profile); | 63 DispatchOnLaunchedEventImpl(extension->id(), launch_data.Pass(), profile); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // static. | 66 // static. |
| 67 void AppEventRouter::DispatchOnRestartedEvent(Profile* profile, | 67 void AppEventRouter::DispatchOnRestartedEvent(Profile* profile, |
| 68 const Extension* extension) { | 68 const Extension* extension) { |
| 69 scoped_ptr<base::ListValue> arguments(new base::ListValue()); | 69 scoped_ptr<base::ListValue> arguments(new base::ListValue()); |
| 70 scoped_ptr<Event> event(new Event(app_runtime::OnRestarted::kEventName, | 70 scoped_ptr<Event> event(new Event(app_runtime::OnRestarted::kEventName, |
| 71 arguments.Pass())); | 71 arguments.Pass())); |
| 72 event->restrict_to_browser_context = profile; | 72 event->restrict_to_browser_context = profile; |
| 73 event->can_load_ephemeral_apps = true; |
| 73 extensions::ExtensionSystem::Get(profile)->event_router()-> | 74 extensions::ExtensionSystem::Get(profile)->event_router()-> |
| 74 DispatchEventToExtension(extension->id(), event.Pass()); | 75 DispatchEventToExtension(extension->id(), event.Pass()); |
| 75 } | 76 } |
| 76 | 77 |
| 77 // static. | 78 // static. |
| 78 void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( | 79 void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
| 79 Profile* profile, const Extension* extension, | 80 Profile* profile, const Extension* extension, |
| 80 const std::string& handler_id, const std::string& mime_type, | 81 const std::string& handler_id, const std::string& mime_type, |
| 81 const extensions::app_file_handler_util::GrantedFileEntry& file_entry) { | 82 const extensions::app_file_handler_util::GrantedFileEntry& file_entry) { |
| 82 // TODO(sergeygs): Use the same way of creating an event (using the generated | 83 // TODO(sergeygs): Use the same way of creating an event (using the generated |
| (...skipping 20 matching lines...) Expand all Loading... |
| 103 const GURL& referrer_url) { | 104 const GURL& referrer_url) { |
| 104 api::app_runtime::LaunchData launch_data; | 105 api::app_runtime::LaunchData launch_data; |
| 105 launch_data.id.reset(new std::string(handler_id)); | 106 launch_data.id.reset(new std::string(handler_id)); |
| 106 launch_data.url.reset(new std::string(url.spec())); | 107 launch_data.url.reset(new std::string(url.spec())); |
| 107 launch_data.referrer_url.reset(new std::string(referrer_url.spec())); | 108 launch_data.referrer_url.reset(new std::string(referrer_url.spec())); |
| 108 DispatchOnLaunchedEventImpl( | 109 DispatchOnLaunchedEventImpl( |
| 109 extension->id(), launch_data.ToValue().Pass(), profile); | 110 extension->id(), launch_data.ToValue().Pass(), profile); |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace extensions | 113 } // namespace extensions |
| OLD | NEW |