| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_extensions_api_client.h" | 5 #include "chrome/browser/extensions/api/chrome_extensions_api_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 38 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
| 39 #include "printing/features/features.h" | 39 #include "printing/features/features.h" |
| 40 | 40 |
| 41 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 42 #include "chrome/browser/extensions/api/file_handlers/non_native_file_system_del
egate_chromeos.h" | 42 #include "chrome/browser/extensions/api/file_handlers/non_native_file_system_del
egate_chromeos.h" |
| 43 #include "chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_
keyboard_delegate.h" | 43 #include "chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_
keyboard_delegate.h" |
| 44 #include "chrome/browser/extensions/clipboard_extension_helper_chromeos.h" | 44 #include "chrome/browser/extensions/clipboard_extension_helper_chromeos.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if BUILDFLAG(ENABLE_PRINTING) | 47 #if BUILDFLAG(ENABLE_PRINTING) |
| 48 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 48 #include "chrome/browser/printing/printing_init.h" |
| 49 #include "chrome/browser/printing/print_preview_message_handler.h" | 49 #endif |
| 50 #include "chrome/browser/printing/print_view_manager.h" | |
| 51 #else | |
| 52 #include "chrome/browser/printing/print_view_manager_basic.h" | |
| 53 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | |
| 54 #endif // BUILDFLAG(ENABLE_PRINTING) | |
| 55 | 50 |
| 56 namespace extensions { | 51 namespace extensions { |
| 57 | 52 |
| 58 ChromeExtensionsAPIClient::ChromeExtensionsAPIClient() {} | 53 ChromeExtensionsAPIClient::ChromeExtensionsAPIClient() {} |
| 59 | 54 |
| 60 ChromeExtensionsAPIClient::~ChromeExtensionsAPIClient() {} | 55 ChromeExtensionsAPIClient::~ChromeExtensionsAPIClient() {} |
| 61 | 56 |
| 62 void ChromeExtensionsAPIClient::AddAdditionalValueStoreCaches( | 57 void ChromeExtensionsAPIClient::AddAdditionalValueStoreCaches( |
| 63 content::BrowserContext* context, | 58 content::BrowserContext* context, |
| 64 const scoped_refptr<ValueStoreFactory>& factory, | 59 const scoped_refptr<ValueStoreFactory>& factory, |
| 65 const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>& | 60 const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>& |
| 66 observers, | 61 observers, |
| 67 std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) { | 62 std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) { |
| 68 // Add support for chrome.storage.sync. | 63 // Add support for chrome.storage.sync. |
| 69 (*caches)[settings_namespace::SYNC] = | 64 (*caches)[settings_namespace::SYNC] = |
| 70 new SyncValueStoreCache(factory, observers, context->GetPath()); | 65 new SyncValueStoreCache(factory, observers, context->GetPath()); |
| 71 | 66 |
| 72 // Add support for chrome.storage.managed. | 67 // Add support for chrome.storage.managed. |
| 73 (*caches)[settings_namespace::MANAGED] = | 68 (*caches)[settings_namespace::MANAGED] = |
| 74 new ManagedValueStoreCache(context, factory, observers); | 69 new ManagedValueStoreCache(context, factory, observers); |
| 75 } | 70 } |
| 76 | 71 |
| 77 void ChromeExtensionsAPIClient::AttachWebContentsHelpers( | 72 void ChromeExtensionsAPIClient::AttachWebContentsHelpers( |
| 78 content::WebContents* web_contents) const { | 73 content::WebContents* web_contents) const { |
| 79 favicon::CreateContentFaviconDriverForWebContents(web_contents); | 74 favicon::CreateContentFaviconDriverForWebContents(web_contents); |
| 80 #if BUILDFLAG(ENABLE_PRINTING) | 75 #if BUILDFLAG(ENABLE_PRINTING) |
| 81 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 76 printing::InitializePrinting(web_contents); |
| 82 printing::PrintViewManager::CreateForWebContents(web_contents); | 77 #endif |
| 83 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents); | |
| 84 #else | |
| 85 printing::PrintViewManagerBasic::CreateForWebContents(web_contents); | |
| 86 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | |
| 87 #endif // BUILDFLAG(ENABLE_PRINTING) | |
| 88 pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( | 78 pdf::PDFWebContentsHelper::CreateForWebContentsWithClient( |
| 89 web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>( | 79 web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>( |
| 90 new ChromePDFWebContentsHelperClient())); | 80 new ChromePDFWebContentsHelperClient())); |
| 91 | 81 |
| 92 data_use_measurement::DataUseWebContentsObserver::CreateForWebContents( | 82 data_use_measurement::DataUseWebContentsObserver::CreateForWebContents( |
| 93 web_contents); | 83 web_contents); |
| 94 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | 84 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( |
| 95 web_contents); | 85 web_contents); |
| 96 } | 86 } |
| 97 | 87 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 const base::Callback<void(const std::string&)>& error_callback) { | 211 const base::Callback<void(const std::string&)>& error_callback) { |
| 222 if (!clipboard_extension_helper_) | 212 if (!clipboard_extension_helper_) |
| 223 clipboard_extension_helper_ = base::MakeUnique<ClipboardExtensionHelper>(); | 213 clipboard_extension_helper_ = base::MakeUnique<ClipboardExtensionHelper>(); |
| 224 clipboard_extension_helper_->DecodeAndSaveImageData( | 214 clipboard_extension_helper_->DecodeAndSaveImageData( |
| 225 image_data, type, std::move(additional_items), success_callback, | 215 image_data, type, std::move(additional_items), success_callback, |
| 226 error_callback); | 216 error_callback); |
| 227 } | 217 } |
| 228 #endif | 218 #endif |
| 229 | 219 |
| 230 } // namespace extensions | 220 } // namespace extensions |
| OLD | NEW |