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

Side by Side Diff: chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Fix SupervisedUserWhitelistInstaller Created 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // This file is for non-chromeos (win & linux) functions, such as 5 // This file is for non-chromeos (win & linux) functions, such as
6 // chrome.input.ime.activate, chrome.input.ime.createWindow and 6 // chrome.input.ime.activate, chrome.input.ime.createWindow and
7 // chrome.input.ime.onSelectionChanged. 7 // chrome.input.ime.onSelectionChanged.
8 // TODO(azurewei): May refactor the code structure by using delegate or 8 // TODO(azurewei): May refactor the code structure by using delegate or
9 // redesign the API to remove this platform-specific file in the future. 9 // redesign the API to remove this platform-specific file in the future.
10 10
11 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" 11 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h"
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h"
jdoerrie 2017/04/06 14:25:50 #include "base/values.h"
vabr (Chromium) 2017/04/07 20:40:40 Done.
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_finder.h" 17 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/input_method/input_method_engine.h" 19 #include "chrome/browser/ui/input_method/input_method_engine.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/extensions/api/input_ime.h" 21 #include "chrome/common/extensions/api/input_ime.h"
21 #include "extensions/browser/extension_prefs.h" 22 #include "extensions/browser/extension_prefs.h"
22 #include "ui/base/ime/ime_bridge.h" 23 #include "ui/base/ime/ime_bridge.h"
23 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
24 25
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 extension(), render_frame_host(), 372 extension(), render_frame_host(),
372 options.url.get() ? *options.url : url::kAboutBlankURL, 373 options.url.get() ? *options.url : url::kAboutBlankURL,
373 options.window_type == input_ime::WINDOW_TYPE_FOLLOWCURSOR 374 options.window_type == input_ime::WINDOW_TYPE_FOLLOWCURSOR
374 ? ui::ImeWindow::FOLLOW_CURSOR 375 ? ui::ImeWindow::FOLLOW_CURSOR
375 : ui::ImeWindow::NORMAL, 376 : ui::ImeWindow::NORMAL,
376 bounds, &error); 377 bounds, &error);
377 if (!frame_id) 378 if (!frame_id)
378 return RespondNow(Error(error)); 379 return RespondNow(Error(error));
379 380
380 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); 381 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
381 result->Set("frameId", new base::Value(frame_id)); 382 result->Set("frameId", base::MakeUnique<base::Value>(frame_id));
382 383
383 return RespondNow(OneArgument(std::move(result))); 384 return RespondNow(OneArgument(std::move(result)));
384 } 385 }
385 386
386 ExtensionFunction::ResponseAction InputImeShowWindowFunction::Run() { 387 ExtensionFunction::ResponseAction InputImeShowWindowFunction::Run() {
387 if (!IsInputImeEnabled()) 388 if (!IsInputImeEnabled())
388 return RespondNow(Error(kErrorAPIDisabled)); 389 return RespondNow(Error(kErrorAPIDisabled));
389 390
390 InputMethodEngine* engine = 391 InputMethodEngine* engine =
391 GetActiveEngine(browser_context(), extension_id()); 392 GetActiveEngine(browser_context(), extension_id());
(...skipping 17 matching lines...) Expand all
409 return RespondNow(Error(kErrorNoActiveEngine)); 410 return RespondNow(Error(kErrorNoActiveEngine));
410 411
411 std::unique_ptr<api::input_ime::HideWindow::Params> params( 412 std::unique_ptr<api::input_ime::HideWindow::Params> params(
412 api::input_ime::HideWindow::Params::Create(*args_)); 413 api::input_ime::HideWindow::Params::Create(*args_));
413 EXTENSION_FUNCTION_VALIDATE(params.get()); 414 EXTENSION_FUNCTION_VALIDATE(params.get());
414 engine->HideImeWindow(params->window_id); 415 engine->HideImeWindow(params->window_id);
415 return RespondNow(NoArguments()); 416 return RespondNow(NoArguments());
416 } 417 }
417 418
418 } // namespace extensions 419 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698