Chromium Code Reviews| 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/app_api.h" | 5 #include "chrome/browser/extensions/api/app/app_api.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | |
| 7 #include "base/values.h" | 8 #include "base/values.h" |
| 8 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | |
| 9 #include "chrome/browser/extensions/app_notification_manager.h" | 11 #include "chrome/browser/extensions/app_notification_manager.h" |
| 10 #include "chrome/browser/extensions/extension_event_router.h" | 12 #include "chrome/browser/extensions/extension_event_router.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
| 16 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 17 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 18 | 20 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 return true; | 115 return true; |
| 114 } | 116 } |
| 115 | 117 |
| 116 // static. | 118 // static. |
| 117 void AppEventRouter::DispatchOnLaunchedEvent( | 119 void AppEventRouter::DispatchOnLaunchedEvent( |
| 118 Profile* profile, const Extension* extension) { | 120 Profile* profile, const Extension* extension) { |
| 119 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 121 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| 120 extension->id(), kOnLaunchedEvent, "[]", NULL, GURL()); | 122 extension->id(), kOnLaunchedEvent, "[]", NULL, GURL()); |
| 121 } | 123 } |
| 122 | 124 |
| 125 // static. | |
| 126 void AppEventRouter::DispatchOnLaunchedEventWithUrl( | |
| 127 Profile* profile, const Extension* extension, const string16& action, | |
| 128 const std::string& mime_type, const GURL& url) { | |
| 129 ListValue args; | |
| 130 DictionaryValue* launch_data = new DictionaryValue(); | |
| 131 DictionaryValue* intent = new DictionaryValue(); | |
| 132 intent->SetString("action", UTF16ToUTF8(action)); | |
| 133 intent->SetString("type", mime_type); | |
| 134 DictionaryValue* extra_data = new DictionaryValue(); | |
| 135 extra_data->SetString("url", url.spec()); | |
| 136 intent->Set("extra_data", extra_data); | |
| 137 launch_data->Set("intent", intent); | |
| 138 args.Append(launch_data); | |
| 139 std::string json_args; | |
| 140 base::JSONWriter::Write(&args, &json_args); | |
| 141 profile->GetExtensionEventRouter()->DispatchEventToExtension( | |
| 142 extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); | |
|
Mihai Parparita -not on Chrome
2012/05/15 00:39:28
Seems like you would also need to update experimen
Greg Billock
2012/05/15 00:54:59
If we're using an idl value, we could put "action"
benwells
2012/05/16 01:35:29
My understanding is that the IDL or JSON provides
benwells
2012/05/18 03:36:02
I've added the launchData field into the json, but
| |
| 143 } | |
| 144 | |
| 123 } // namespace extensions | 145 } // namespace extensions |
| OLD | NEW |