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/values.h" | 8 #include "base/values.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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 Profile* profile, const Extension* extension, const string16& action, | 128 Profile* profile, const Extension* extension, const string16& action, |
129 const std::string& file_system_id, const FilePath& base_name) { | 129 const std::string& file_system_id, const FilePath& base_name) { |
130 ListValue args; | 130 ListValue args; |
131 DictionaryValue* launch_data = new DictionaryValue(); | 131 DictionaryValue* launch_data = new DictionaryValue(); |
132 DictionaryValue* intent = new DictionaryValue(); | 132 DictionaryValue* intent = new DictionaryValue(); |
133 intent->SetString("action", UTF16ToUTF8(action)); | 133 intent->SetString("action", UTF16ToUTF8(action)); |
134 launch_data->Set("intent", intent); | 134 launch_data->Set("intent", intent); |
135 intent->SetString("type", "chrome-extension://fileentry"); | 135 intent->SetString("type", "chrome-extension://fileentry"); |
136 args.Append(launch_data); | 136 args.Append(launch_data); |
137 args.Append(Value::CreateStringValue(file_system_id)); | 137 args.Append(Value::CreateStringValue(file_system_id)); |
138 #if defined(OS_WIN) | 138 args.Append(Value::CreateStringValue(base_name.AsUTF8Unsafe())); |
139 args.Append(Value::CreateStringValue(UTF16ToUTF8(base_name.value()))); | |
140 #else | |
141 args.Append(Value::CreateStringValue(base_name.value())); | |
142 #endif | |
143 std::string json_args; | 139 std::string json_args; |
144 base::JSONWriter::Write(&args, &json_args); | 140 base::JSONWriter::Write(&args, &json_args); |
145 profile->GetExtensionEventRouter()->DispatchEventToExtension( | 141 profile->GetExtensionEventRouter()->DispatchEventToExtension( |
146 extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); | 142 extension->id(), kOnLaunchedEvent, json_args, NULL, GURL()); |
147 } | 143 } |
148 | 144 |
149 } // namespace extensions | 145 } // namespace extensions |
OLD | NEW |