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::DispatchOnLaunchedEventWithFileEntry( | |
| 127 Profile* profile, const Extension* extension, const string16& action, | |
| 128 const std::string& mime_type, const std::string& file_system_id, | |
| 129 const std::string& base_name) { | |
| 130 ListValue args; | |
| 131 DictionaryValue* launch_data = new DictionaryValue(); | |
| 132 DictionaryValue* intent = new DictionaryValue(); | |
| 133 intent->SetString("action", UTF16ToUTF8(action)); | |
| 134 intent->SetString("type", mime_type); | |
|
Greg Billock
2012/05/18 14:14:39
Our documentation for MIME type passing is here: h
benwells
2012/05/21 04:26:32
Greg: I want to make sure I understand properly: d
Greg Billock
2012/05/21 14:25:34
Right. We don't really have a limitation on the ty
benwells
2012/05/22 13:15:03
Done.
| |
| 135 launch_data->Set("intent", intent); | |
| 136 args.Append(launch_data); | |
| 137 args.Append(Value::CreateStringValue(file_system_id)); | |
| 138 args.Append(Value::CreateStringValue(base_name)); | |
| 139 std::string json_args; | |
| 140 base::JSONWriter::Write(&args, &json_args); | |
| 141 profile->GetExtensionEventRouter()->DispatchEventToExtension( | |
| 142 extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); | |
| 143 } | |
| 144 | |
| 123 } // namespace extensions | 145 } // namespace extensions |
| OLD | NEW |