Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/browser/intents/native_services.cc

Issue 11071005: Add native file picker impl using SelectFileDialog. (Closed) Base URL: http://git.chromium.org/chromium/src.git@filePicker
Patch Set: Remove ifdefs for VIEWS toolkit. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 11 matching lines...) Expand all
22 22
23 NativeServiceRegistry::NativeServiceRegistry() {} 23 NativeServiceRegistry::NativeServiceRegistry() {}
24 24
25 void NativeServiceRegistry::GetSupportedServices( 25 void NativeServiceRegistry::GetSupportedServices(
26 const string16& action, 26 const string16& action,
27 IntentServiceList* services) { 27 IntentServiceList* services) {
28 if (!CommandLine::ForCurrentProcess()->HasSwitch( 28 if (!CommandLine::ForCurrentProcess()->HasSwitch(
29 switches::kWebIntentsNativeServicesEnabled)) 29 switches::kWebIntentsNativeServicesEnabled))
30 return; 30 return;
31 31
32 #if defined(TOOLKIT_VIEWS)
33 if (EqualsASCII(action, web_intents::kActionPick)) { 32 if (EqualsASCII(action, web_intents::kActionPick)) {
34 // File picker registrations. 33 // File picker registrations.
35 webkit_glue::WebIntentServiceData service( 34 webkit_glue::WebIntentServiceData service(
36 ASCIIToUTF16(kActionPick), 35 ASCIIToUTF16(kActionPick),
37 ASCIIToUTF16("*/*"), // handle any MIME-type 36 ASCIIToUTF16("*/*"), // handle any MIME-type
38 string16(), 37 string16(),
39 GURL(web_intents::kNativeFilePickerUrl), 38 GURL(web_intents::kNativeFilePickerUrl),
40 FilePickerFactory::GetServiceTitle()); 39 FilePickerFactory::GetServiceTitle());
41 service.disposition = webkit_glue::WebIntentServiceData::DISPOSITION_NATIVE; 40 service.disposition = webkit_glue::WebIntentServiceData::DISPOSITION_NATIVE;
42 41
43 services->push_back(service); 42 services->push_back(service);
44 } 43 }
45 #endif
46 } 44 }
47 45
48 NativeServiceFactory::NativeServiceFactory() {} 46 NativeServiceFactory::NativeServiceFactory() {}
49 47
50 IntentServiceHost* NativeServiceFactory::CreateServiceInstance( 48 IntentServiceHost* NativeServiceFactory::CreateServiceInstance(
51 const GURL& service_url, 49 const GURL& service_url,
52 const webkit_glue::WebIntentData& intent) { 50 const webkit_glue::WebIntentData& intent,
51 content::WebContents* web_contents) {
53 52
54 #if defined(TOOLKIT_VIEWS)
55 if (service_url.spec() == kNativeFilePickerUrl) { 53 if (service_url.spec() == kNativeFilePickerUrl) {
56 return FilePickerFactory::CreateServiceInstance(intent); 54 return FilePickerFactory::CreateServiceInstance(web_contents, intent);
57 } 55 }
58 #endif
59 56
60 return NULL; // couldn't create instance 57 return NULL; // couldn't create instance
61 } 58 }
62 59
63 } // web_intents namespace 60 } // web_intents namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698