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/platform_app_launcher.h" | 5 #include "chrome/browser/extensions/platform_app_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 LOG(WARNING) << "Extension does not provide a valid file handler for " | 167 LOG(WARNING) << "Extension does not provide a valid file handler for " |
168 << file_path_.value(); | 168 << file_path_.value(); |
169 LaunchWithNoLaunchData(); | 169 LaunchWithNoLaunchData(); |
170 return; | 170 return; |
171 } | 171 } |
172 found_service = !!handler; | 172 found_service = !!handler; |
173 | 173 |
174 // TODO(benwells): remove this once we no longer support the "intents" | 174 // TODO(benwells): remove this once we no longer support the "intents" |
175 // syntax in platform app manifests. | 175 // syntax in platform app manifests. |
176 if (!found_service) { | 176 if (!found_service) { |
| 177 #if defined(ENABLE_WEB_INTENTS) |
177 std::vector<webkit_glue::WebIntentServiceData> services = | 178 std::vector<webkit_glue::WebIntentServiceData> services = |
178 extensions::WebIntentsInfo::GetIntentsServices(extension_); | 179 extensions::WebIntentsInfo::GetIntentsServices(extension_); |
179 for (size_t i = 0; i < services.size(); i++) { | 180 for (size_t i = 0; i < services.size(); i++) { |
180 std::string service_type_ascii = UTF16ToASCII(services[i].type); | 181 std::string service_type_ascii = UTF16ToASCII(services[i].type); |
181 if (services[i].action == ASCIIToUTF16(web_intents::kActionView) && | 182 if (services[i].action == ASCIIToUTF16(web_intents::kActionView) && |
182 net::MatchesMimeType(service_type_ascii, mime_type)) { | 183 net::MatchesMimeType(service_type_ascii, mime_type)) { |
183 found_service = true; | 184 found_service = true; |
184 break; | 185 break; |
185 } | 186 } |
186 } | 187 } |
| 188 #endif |
187 } | 189 } |
188 | 190 |
189 // If this app doesn't have an intent that supports the file, launch with | 191 // If this app doesn't have an intent that supports the file, launch with |
190 // no launch data. | 192 // no launch data. |
191 if (!found_service) { | 193 if (!found_service) { |
192 LOG(WARNING) << "Extension does not provide a valid file handler for " | 194 LOG(WARNING) << "Extension does not provide a valid file handler for " |
193 << file_path_.value(); | 195 << file_path_.value(); |
194 LaunchWithNoLaunchData(); | 196 LaunchWithNoLaunchData(); |
195 return; | 197 return; |
196 } | 198 } |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 const Extension* extension, | 413 const Extension* extension, |
412 content::WebIntentsDispatcher* intents_dispatcher, | 414 content::WebIntentsDispatcher* intents_dispatcher, |
413 content::WebContents* source) { | 415 content::WebContents* source) { |
414 scoped_refptr<PlatformAppWebIntentLauncher> launcher = | 416 scoped_refptr<PlatformAppWebIntentLauncher> launcher = |
415 new PlatformAppWebIntentLauncher( | 417 new PlatformAppWebIntentLauncher( |
416 profile, extension, intents_dispatcher, source); | 418 profile, extension, intents_dispatcher, source); |
417 launcher->Launch(); | 419 launcher->Launch(); |
418 } | 420 } |
419 | 421 |
420 } // namespace extensions | 422 } // namespace extensions |
OLD | NEW |