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

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

Issue 2360073002: [Extensions] Isolate ExtensionFunction results_ and error_ (Closed)
Patch Set: errorwithargs 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 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
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 bounds.set_y(options.bounds->top); 348 bounds.set_y(options.bounds->top);
349 bounds.set_width(options.bounds->width); 349 bounds.set_width(options.bounds->width);
350 bounds.set_height(options.bounds->height); 350 bounds.set_height(options.bounds->height);
351 } 351 }
352 352
353 InputMethodEngine* engine = 353 InputMethodEngine* engine =
354 GetActiveEngine(browser_context(), extension_id()); 354 GetActiveEngine(browser_context(), extension_id());
355 if (!engine) 355 if (!engine)
356 return RespondNow(Error(kErrorNoActiveEngine)); 356 return RespondNow(Error(kErrorNoActiveEngine));
357 357
358 std::string error;
358 int frame_id = engine->CreateImeWindow( 359 int frame_id = engine->CreateImeWindow(
359 extension(), render_frame_host(), 360 extension(), render_frame_host(),
360 options.url.get() ? *options.url : url::kAboutBlankURL, 361 options.url.get() ? *options.url : url::kAboutBlankURL,
361 options.window_type == input_ime::WINDOW_TYPE_FOLLOWCURSOR 362 options.window_type == input_ime::WINDOW_TYPE_FOLLOWCURSOR
362 ? ui::ImeWindow::FOLLOW_CURSOR 363 ? ui::ImeWindow::FOLLOW_CURSOR
363 : ui::ImeWindow::NORMAL, 364 : ui::ImeWindow::NORMAL,
364 bounds, &error_); 365 bounds, &error);
365 if (!frame_id) 366 if (!frame_id)
366 return RespondNow(Error(error_)); 367 return RespondNow(Error(error));
367 368
368 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); 369 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
369 result->Set("frameId", new base::FundamentalValue(frame_id)); 370 result->Set("frameId", new base::FundamentalValue(frame_id));
370 371
371 return RespondNow(OneArgument(std::move(result))); 372 return RespondNow(OneArgument(std::move(result)));
372 } 373 }
373 374
374 ExtensionFunction::ResponseAction InputImeShowWindowFunction::Run() { 375 ExtensionFunction::ResponseAction InputImeShowWindowFunction::Run() {
375 if (!IsInputImeEnabled()) 376 if (!IsInputImeEnabled())
376 return RespondNow(Error(kErrorAPIDisabled)); 377 return RespondNow(Error(kErrorAPIDisabled));
(...skipping 20 matching lines...) Expand all
397 return RespondNow(Error(kErrorNoActiveEngine)); 398 return RespondNow(Error(kErrorNoActiveEngine));
398 399
399 std::unique_ptr<api::input_ime::HideWindow::Params> params( 400 std::unique_ptr<api::input_ime::HideWindow::Params> params(
400 api::input_ime::HideWindow::Params::Create(*args_)); 401 api::input_ime::HideWindow::Params::Create(*args_));
401 EXTENSION_FUNCTION_VALIDATE(params.get()); 402 EXTENSION_FUNCTION_VALIDATE(params.get());
402 engine->HideImeWindow(params->window_id); 403 engine->HideImeWindow(params->window_id);
403 return RespondNow(NoArguments()); 404 return RespondNow(NoArguments());
404 } 405 }
405 406
406 } // namespace extensions 407 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698