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

Side by Side Diff: chrome/browser/ui/ash/chrome_keyboard_ui.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/ui/ash/chrome_keyboard_ui.h" 5 #include "chrome/browser/ui/ash/chrome_keyboard_ui.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/shell_window_ids.h" 9 #include "ash/common/shell_window_ids.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 return; 88 return;
89 } 89 }
90 90
91 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); 91 std::unique_ptr<base::ListValue> event_args(new base::ListValue());
92 std::unique_ptr<base::DictionaryValue> new_bounds( 92 std::unique_ptr<base::DictionaryValue> new_bounds(
93 new base::DictionaryValue()); 93 new base::DictionaryValue());
94 new_bounds->SetInteger("left", bounds.x()); 94 new_bounds->SetInteger("left", bounds.x());
95 new_bounds->SetInteger("top", bounds.y()); 95 new_bounds->SetInteger("top", bounds.y());
96 new_bounds->SetInteger("width", bounds.width()); 96 new_bounds->SetInteger("width", bounds.width());
97 new_bounds->SetInteger("height", bounds.height()); 97 new_bounds->SetInteger("height", bounds.height());
98 event_args->Append(new_bounds.release()); 98 event_args->Append(std::move(new_bounds));
99 99
100 std::unique_ptr<extensions::Event> event(new extensions::Event( 100 std::unique_ptr<extensions::Event> event(new extensions::Event(
101 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_BOUNDS_CHANGED, 101 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_BOUNDS_CHANGED,
102 virtual_keyboard_private::OnBoundsChanged::kEventName, 102 virtual_keyboard_private::OnBoundsChanged::kEventName,
103 std::move(event_args))); 103 std::move(event_args)));
104 event->restrict_to_browser_context = context_; 104 event->restrict_to_browser_context = context_;
105 router->BroadcastEvent(std::move(event)); 105 router->BroadcastEvent(std::move(event));
106 } 106 }
107 107
108 void OnKeyboardClosed() override { 108 void OnKeyboardClosed() override {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 virtual_keyboard_private::OnTextInputBoxFocused::kEventName)) { 226 virtual_keyboard_private::OnTextInputBoxFocused::kEventName)) {
227 return; 227 return;
228 } 228 }
229 229
230 std::unique_ptr<base::ListValue> event_args(new base::ListValue()); 230 std::unique_ptr<base::ListValue> event_args(new base::ListValue());
231 std::unique_ptr<base::DictionaryValue> input_context( 231 std::unique_ptr<base::DictionaryValue> input_context(
232 new base::DictionaryValue()); 232 new base::DictionaryValue());
233 input_context->SetString("type", 233 input_context->SetString("type",
234 virtual_keyboard_private::ToString( 234 virtual_keyboard_private::ToString(
235 TextInputTypeToGeneratedInputTypeEnum(type))); 235 TextInputTypeToGeneratedInputTypeEnum(type)));
236 event_args->Append(input_context.release()); 236 event_args->Append(std::move(input_context));
237 237
238 std::unique_ptr<extensions::Event> event(new extensions::Event( 238 std::unique_ptr<extensions::Event> event(new extensions::Event(
239 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_TEXT_INPUT_BOX_FOCUSED, 239 extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_TEXT_INPUT_BOX_FOCUSED,
240 virtual_keyboard_private::OnTextInputBoxFocused::kEventName, 240 virtual_keyboard_private::OnTextInputBoxFocused::kEventName,
241 std::move(event_args))); 241 std::move(event_args)));
242 event->restrict_to_browser_context = browser_context(); 242 event->restrict_to_browser_context = browser_context();
243 router->DispatchEventToExtension(kVirtualKeyboardExtensionID, 243 router->DispatchEventToExtension(kVirtualKeyboardExtensionID,
244 std::move(event)); 244 std::move(event));
245 } 245 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698