| 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/json/json_writer.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // static. | 121 // static. |
| 122 void AppEventRouter::DispatchOnLaunchedEvent( | 122 void AppEventRouter::DispatchOnLaunchedEvent( |
| 123 Profile* profile, const Extension* extension) { | 123 Profile* profile, const Extension* extension) { |
| 124 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 124 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| 125 extension->id(), kOnLaunchedEvent, "[]", NULL, GURL()); | 125 extension->id(), kOnLaunchedEvent, "[]", NULL, GURL()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // static. | 128 // static. |
| 129 void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( | 129 void AppEventRouter::DispatchOnLaunchedEventWithFileEntry( |
| 130 Profile* profile, const Extension* extension, const string16& action, | 130 Profile* profile, const Extension* extension, const string16& action, |
| 131 const std::string& file_system_id, const FilePath& base_name) { | 131 const std::string& file_system_id, const std::string& base_name) { |
| 132 ListValue args; | 132 ListValue args; |
| 133 DictionaryValue* launch_data = new DictionaryValue(); | 133 DictionaryValue* launch_data = new DictionaryValue(); |
| 134 DictionaryValue* intent = new DictionaryValue(); | 134 DictionaryValue* intent = new DictionaryValue(); |
| 135 intent->SetString("action", UTF16ToUTF8(action)); | 135 intent->SetString("action", UTF16ToUTF8(action)); |
| 136 intent->SetString("type", "chrome-extension://fileentry"); | 136 intent->SetString("type", "chrome-extension://fileentry"); |
| 137 launch_data->Set("intent", intent); | 137 launch_data->Set("intent", intent); |
| 138 args.Append(launch_data); | 138 args.Append(launch_data); |
| 139 DictionaryValue* intent_data = new DictionaryValue(); | 139 DictionaryValue* intent_data = new DictionaryValue(); |
| 140 intent_data->SetString("format", "fileEntry"); | 140 intent_data->SetString("format", "fileEntry"); |
| 141 intent_data->SetString("fileSystemId", file_system_id); | 141 intent_data->SetString("fileSystemId", file_system_id); |
| 142 intent_data->SetString("baseName", base_name.value()); | 142 intent_data->SetString("baseName", base_name); |
| 143 args.Append(intent_data); | 143 args.Append(intent_data); |
| 144 std::string json_args; | 144 std::string json_args; |
| 145 base::JSONWriter::Write(&args, &json_args); | 145 base::JSONWriter::Write(&args, &json_args); |
| 146 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 146 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| 147 extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); | 147 extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 // static. | 150 // static. |
| 151 void AppEventRouter::DispatchOnLaunchedEventWithWebIntent( | 151 void AppEventRouter::DispatchOnLaunchedEventWithWebIntent( |
| 152 Profile* profile, const Extension* extension, | 152 Profile* profile, const Extension* extension, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 181 NOTREACHED(); | 181 NOTREACHED(); |
| 182 break; | 182 break; |
| 183 } | 183 } |
| 184 std::string json_args; | 184 std::string json_args; |
| 185 base::JSONWriter::Write(&args, &json_args); | 185 base::JSONWriter::Write(&args, &json_args); |
| 186 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 186 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
| 187 extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); | 187 extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace extensions | 190 } // namespace extensions |
| OLD | NEW |