| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 "extensions/browser/api/clipboard/clipboard_api.h" | 5 #include "extensions/browser/api/clipboard/clipboard_api.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "extensions/browser/api/extensions_api_client.h" | 12 #include "extensions/browser/api/extensions_api_client.h" |
| 13 #include "extensions/browser/event_router.h" | 13 #include "extensions/browser/event_router.h" |
| 14 #include "ui/base/clipboard/clipboard_monitor.h" | 14 #include "ui/base/clipboard/clipboard_monitor.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 namespace clipboard = api::clipboard; | 18 namespace clipboard = api::clipboard; |
| 19 | 19 |
| 20 static base::LazyInstance<BrowserContextKeyedAPIFactory<ClipboardAPI>> | 20 static base::LazyInstance< |
| 21 g_factory = LAZY_INSTANCE_INITIALIZER; | 21 BrowserContextKeyedAPIFactory<ClipboardAPI>>::DestructorAtExit g_factory = |
| 22 LAZY_INSTANCE_INITIALIZER; |
| 22 | 23 |
| 23 // static | 24 // static |
| 24 BrowserContextKeyedAPIFactory<ClipboardAPI>* | 25 BrowserContextKeyedAPIFactory<ClipboardAPI>* |
| 25 ClipboardAPI::GetFactoryInstance() { | 26 ClipboardAPI::GetFactoryInstance() { |
| 26 return g_factory.Pointer(); | 27 return g_factory.Pointer(); |
| 27 } | 28 } |
| 28 | 29 |
| 29 ClipboardAPI::ClipboardAPI(content::BrowserContext* context) | 30 ClipboardAPI::ClipboardAPI(content::BrowserContext* context) |
| 30 : browser_context_(context) { | 31 : browser_context_(context) { |
| 31 ui::ClipboardMonitor::GetInstance()->AddObserver(this); | 32 ui::ClipboardMonitor::GetInstance()->AddObserver(this); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 void ClipboardSetImageDataFunction::OnSaveImageDataSuccess() { | 64 void ClipboardSetImageDataFunction::OnSaveImageDataSuccess() { |
| 64 Respond(NoArguments()); | 65 Respond(NoArguments()); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void ClipboardSetImageDataFunction::OnSaveImageDataError( | 68 void ClipboardSetImageDataFunction::OnSaveImageDataError( |
| 68 const std::string& error) { | 69 const std::string& error) { |
| 69 Respond(Error(error)); | 70 Respond(Error(error)); |
| 70 } | 71 } |
| 71 | 72 |
| 72 } // namespace extensions | 73 } // namespace extensions |
| OLD | NEW |