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

Side by Side Diff: chrome/browser/chromeos/extensions/ime_menu_event_router.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iwyu fixes Created 4 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/chromeos/extensions/ime_menu_event_router.h" 5 #include "chrome/browser/chromeos/extensions/ime_menu_event_router.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/chromeos/extensions/input_method_api.h" 8 #include "chrome/browser/chromeos/extensions/input_method_api.h"
9 #include "chrome/common/extensions/api/input_method_private.h" 9 #include "chrome/common/extensions/api/input_method_private.h"
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
(...skipping 18 matching lines...) Expand all
29 ExtensionImeMenuEventRouter::~ExtensionImeMenuEventRouter() { 29 ExtensionImeMenuEventRouter::~ExtensionImeMenuEventRouter() {
30 input_method::InputMethodManager::Get()->RemoveImeMenuObserver(this); 30 input_method::InputMethodManager::Get()->RemoveImeMenuObserver(this);
31 } 31 }
32 32
33 void ExtensionImeMenuEventRouter::ImeMenuActivationChanged(bool activation) { 33 void ExtensionImeMenuEventRouter::ImeMenuActivationChanged(bool activation) {
34 extensions::EventRouter* router = extensions::EventRouter::Get(context_); 34 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
35 35
36 if (!router->HasEventListener(OnImeMenuActivationChanged::kEventName)) 36 if (!router->HasEventListener(OnImeMenuActivationChanged::kEventName))
37 return; 37 return;
38 38
39 scoped_ptr<base::ListValue> args(new base::ListValue()); 39 std::unique_ptr<base::ListValue> args(new base::ListValue());
40 args->AppendBoolean(activation); 40 args->AppendBoolean(activation);
41 41
42 // The router will only send the event to extensions that are listening. 42 // The router will only send the event to extensions that are listening.
43 scoped_ptr<extensions::Event> event(new extensions::Event( 43 std::unique_ptr<extensions::Event> event(new extensions::Event(
44 extensions::events::INPUT_METHOD_PRIVATE_ON_IME_MENU_ACTIVATION_CHANGED, 44 extensions::events::INPUT_METHOD_PRIVATE_ON_IME_MENU_ACTIVATION_CHANGED,
45 OnImeMenuActivationChanged::kEventName, std::move(args))); 45 OnImeMenuActivationChanged::kEventName, std::move(args)));
46 event->restrict_to_browser_context = context_; 46 event->restrict_to_browser_context = context_;
47 router->BroadcastEvent(std::move(event)); 47 router->BroadcastEvent(std::move(event));
48 } 48 }
49 49
50 void ExtensionImeMenuEventRouter::ImeMenuListChanged() { 50 void ExtensionImeMenuEventRouter::ImeMenuListChanged() {
51 extensions::EventRouter* router = extensions::EventRouter::Get(context_); 51 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
52 52
53 if (!router->HasEventListener(OnImeMenuListChanged::kEventName)) 53 if (!router->HasEventListener(OnImeMenuListChanged::kEventName))
54 return; 54 return;
55 55
56 scoped_ptr<base::ListValue> args(new base::ListValue()); 56 std::unique_ptr<base::ListValue> args(new base::ListValue());
57 57
58 // The router will only send the event to extensions that are listening. 58 // The router will only send the event to extensions that are listening.
59 scoped_ptr<extensions::Event> event(new extensions::Event( 59 std::unique_ptr<extensions::Event> event(new extensions::Event(
60 extensions::events::INPUT_METHOD_PRIVATE_ON_IME_MENU_LIST_CHANGED, 60 extensions::events::INPUT_METHOD_PRIVATE_ON_IME_MENU_LIST_CHANGED,
61 OnImeMenuListChanged::kEventName, std::move(args))); 61 OnImeMenuListChanged::kEventName, std::move(args)));
62 event->restrict_to_browser_context = context_; 62 event->restrict_to_browser_context = context_;
63 router->BroadcastEvent(std::move(event)); 63 router->BroadcastEvent(std::move(event));
64 } 64 }
65 65
66 void ExtensionImeMenuEventRouter::ImeMenuItemsChanged( 66 void ExtensionImeMenuEventRouter::ImeMenuItemsChanged(
67 const std::string& engine_id, 67 const std::string& engine_id,
68 const std::vector<input_method::InputMethodManager::MenuItem>& items) { 68 const std::vector<input_method::InputMethodManager::MenuItem>& items) {
69 extensions::EventRouter* router = extensions::EventRouter::Get(context_); 69 extensions::EventRouter* router = extensions::EventRouter::Get(context_);
(...skipping 18 matching lines...) Expand all
88 break; 88 break;
89 default: 89 default:
90 menu_item.style = input_method_private::ParseMenuItemStyle(""); 90 menu_item.style = input_method_private::ParseMenuItemStyle("");
91 } 91 }
92 menu_item.visible.reset(new bool(item.visible)); 92 menu_item.visible.reset(new bool(item.visible));
93 menu_item.checked.reset(new bool(item.checked)); 93 menu_item.checked.reset(new bool(item.checked));
94 menu_item.enabled.reset(new bool(item.enabled)); 94 menu_item.enabled.reset(new bool(item.enabled));
95 menu_items.push_back(std::move(menu_item)); 95 menu_items.push_back(std::move(menu_item));
96 } 96 }
97 97
98 scoped_ptr<base::ListValue> args = 98 std::unique_ptr<base::ListValue> args =
99 OnImeMenuItemsChanged::Create(engine_id, menu_items); 99 OnImeMenuItemsChanged::Create(engine_id, menu_items);
100 100
101 // The router will only send the event to extensions that are listening. 101 // The router will only send the event to extensions that are listening.
102 scoped_ptr<extensions::Event> event(new extensions::Event( 102 std::unique_ptr<extensions::Event> event(new extensions::Event(
103 extensions::events::INPUT_METHOD_PRIVATE_ON_IME_MENU_ITEMS_CHANGED, 103 extensions::events::INPUT_METHOD_PRIVATE_ON_IME_MENU_ITEMS_CHANGED,
104 OnImeMenuItemsChanged::kEventName, std::move(args))); 104 OnImeMenuItemsChanged::kEventName, std::move(args)));
105 event->restrict_to_browser_context = context_; 105 event->restrict_to_browser_context = context_;
106 router->BroadcastEvent(std::move(event)); 106 router->BroadcastEvent(std::move(event));
107 } 107 }
108 108
109 } // namespace chromeos 109 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698