Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #include "components/pdf/browser/pdf_web_contents_helper.h" | 29 #include "components/pdf/browser/pdf_web_contents_helper.h" |
| 30 #include "content/public/browser/browser_context.h" | 30 #include "content/public/browser/browser_context.h" |
| 31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
| 32 #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_deleg ate.h" | 32 #include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_deleg ate.h" |
| 33 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 33 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 34 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 34 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
| 35 #include "printing/features/features.h" | 35 #include "printing/features/features.h" |
| 36 | 36 |
| 37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 38 #include "chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_ keyboard_delegate.h" | 38 #include "chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_ keyboard_delegate.h" |
| 39 #include "chrome/browser/extensions/clipboard_extension_helper_chromeos.h" | |
| 39 #endif | 40 #endif |
| 40 | 41 |
| 41 #if BUILDFLAG(ENABLE_PRINTING) | 42 #if BUILDFLAG(ENABLE_PRINTING) |
| 42 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 43 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 43 #include "chrome/browser/printing/print_preview_message_handler.h" | 44 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 44 #include "chrome/browser/printing/print_view_manager.h" | 45 #include "chrome/browser/printing/print_view_manager.h" |
| 45 #else | 46 #else |
| 46 #include "chrome/browser/printing/print_view_manager_basic.h" | 47 #include "chrome/browser/printing/print_view_manager_basic.h" |
| 47 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 48 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 48 #endif // BUILDFLAG(ENABLE_PRINTING) | 49 #endif // BUILDFLAG(ENABLE_PRINTING) |
| 49 | 50 |
| 50 namespace extensions { | 51 namespace extensions { |
| 51 | 52 |
| 52 ChromeExtensionsAPIClient::ChromeExtensionsAPIClient() {} | 53 ChromeExtensionsAPIClient::ChromeExtensionsAPIClient() { |
|
Devlin
2016/12/21 23:58:38
Why this change?
jennyz
2016/12/22 22:45:21
I thought you suggested me to move it to ChromeExt
Devlin
2016/12/27 17:08:00
Yes. But why do we need to put a newline here? I
jennyz
2016/12/29 05:16:03
Done.
| |
| 54 } | |
| 53 | 55 |
| 54 ChromeExtensionsAPIClient::~ChromeExtensionsAPIClient() {} | 56 ChromeExtensionsAPIClient::~ChromeExtensionsAPIClient() {} |
| 55 | 57 |
| 56 void ChromeExtensionsAPIClient::AddAdditionalValueStoreCaches( | 58 void ChromeExtensionsAPIClient::AddAdditionalValueStoreCaches( |
| 57 content::BrowserContext* context, | 59 content::BrowserContext* context, |
| 58 const scoped_refptr<ValueStoreFactory>& factory, | 60 const scoped_refptr<ValueStoreFactory>& factory, |
| 59 const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>& | 61 const scoped_refptr<base::ObserverListThreadSafe<SettingsObserver>>& |
| 60 observers, | 62 observers, |
| 61 std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) { | 63 std::map<settings_namespace::Namespace, ValueStoreCache*>* caches) { |
| 62 // Add support for chrome.storage.sync. | 64 // Add support for chrome.storage.sync. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 const { | 161 const { |
| 160 return new ChromeManagementAPIDelegate; | 162 return new ChromeManagementAPIDelegate; |
| 161 } | 163 } |
| 162 | 164 |
| 163 MetricsPrivateDelegate* ChromeExtensionsAPIClient::GetMetricsPrivateDelegate() { | 165 MetricsPrivateDelegate* ChromeExtensionsAPIClient::GetMetricsPrivateDelegate() { |
| 164 if (!metrics_private_delegate_) | 166 if (!metrics_private_delegate_) |
| 165 metrics_private_delegate_.reset(new ChromeMetricsPrivateDelegate()); | 167 metrics_private_delegate_.reset(new ChromeMetricsPrivateDelegate()); |
| 166 return metrics_private_delegate_.get(); | 168 return metrics_private_delegate_.get(); |
| 167 } | 169 } |
| 168 | 170 |
| 171 #if defined(OS_CHROMEOS) | |
| 172 void ChromeExtensionsAPIClient::SaveImageDataToClipboard( | |
| 173 const std::vector<char>& image_data, | |
| 174 api::clipboard::ImageType type, | |
| 175 const base::Closure& success_callback, | |
| 176 const base::Callback<void(const std::string&)>& error_callback) { | |
| 177 if (!clipboard_extension_helper_) | |
| 178 clipboard_extension_helper_.reset(new ClipboardExtensionHelper()); | |
|
Devlin
2016/12/21 23:58:38
prefer MakeUnique
jennyz
2016/12/22 22:45:21
Done.
| |
| 179 clipboard_extension_helper_->DecodeAndSaveImageData( | |
| 180 image_data, type, success_callback, error_callback); | |
| 181 } | |
| 182 #endif | |
| 183 | |
| 169 } // namespace extensions | 184 } // namespace extensions |
| OLD | NEW |