| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/logging.h" | |
| 6 #include "base/string16.h" | |
| 7 #include "chrome/browser/intents/intent_service_host.h" | |
| 8 #include "chrome/browser/intents/native_services.h" | |
| 9 #include "chrome/browser/intents/web_intents_util.h" | |
| 10 #include "content/public/browser/web_intents_dispatcher.h" | |
| 11 #include "googleurl/src/gurl.h" | |
| 12 #include "grit/generated_resources.h" | |
| 13 #include "ui/base/l10n/l10n_util.h" | |
| 14 #include "webkit/glue/web_intent_service_data.h" | |
| 15 | |
| 16 namespace web_intents { | |
| 17 namespace { | |
| 18 // FilePicker service allowing a native file picker to handle | |
| 19 // pick+*/* intents. | |
| 20 class ViewsFilePickerService : public IntentServiceHost { | |
| 21 public: | |
| 22 ViewsFilePickerService(); | |
| 23 virtual void HandleIntent(content::WebIntentsDispatcher* dispatcher) OVERRIDE; | |
| 24 | |
| 25 private: | |
| 26 virtual ~ViewsFilePickerService(); | |
| 27 | |
| 28 DISALLOW_COPY_AND_ASSIGN(ViewsFilePickerService); | |
| 29 }; | |
| 30 | |
| 31 } // namespace | |
| 32 | |
| 33 ViewsFilePickerService::ViewsFilePickerService() {} | |
| 34 | |
| 35 void ViewsFilePickerService::HandleIntent( | |
| 36 content::WebIntentsDispatcher* dispatcher) { | |
| 37 dispatcher->SendReplyMessage( | |
| 38 webkit_glue::WEB_INTENT_REPLY_FAILURE, string16()); | |
| 39 delete this; | |
| 40 } | |
| 41 | |
| 42 ViewsFilePickerService::~ViewsFilePickerService() {} | |
| 43 | |
| 44 // static | |
| 45 IntentServiceHost* FilePickerFactory::CreateServiceInstance( | |
| 46 const webkit_glue::WebIntentData& intent) { | |
| 47 return new ViewsFilePickerService(); | |
| 48 } | |
| 49 | |
| 50 // Returns the action-specific string for |action|. | |
| 51 string16 FilePickerFactory::GetServiceTitle() { | |
| 52 return l10n_util::GetStringUTF16(IDS_WEB_INTENTS_FILE_PICKER_SERVICE_TITLE); | |
| 53 } | |
| 54 | |
| 55 } // web_intents namespace | |
| OLD | NEW |