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

Unified Diff: chrome/browser/extensions/extension_ime_ui_api.h

Issue 6869024: Add IME UI related extension API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Update Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_ime_ui_api.h
diff --git a/chrome/browser/extensions/extension_ime_ui_api.h b/chrome/browser/extensions/extension_ime_ui_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..e7d47eca796e116214ed5b38511c6127f939f843
--- /dev/null
+++ b/chrome/browser/extensions/extension_ime_ui_api.h
@@ -0,0 +1,115 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_IME_UI_API_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_IME_UI_API_H_
+#pragma once
+
+#include <string>
+
+#include "base/memory/singleton.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/extensions/extension_function.h"
+
+class ImeUiController;
+class ListValue;
+class Profile;
+
+namespace chromeos {
+class InputMethodLookupTable;
+}
+
+class ExtensionImeUiEventRouter {
+ public:
+ static ExtensionImeUiEventRouter* GetInstance();
+ void Init();
+
+ private:
+ friend class ImeUiController;
+ friend class CandidateClickedImeUiFunction;
+ friend class CursorUpImeUiFunction;
+ friend class CursorDownImeUiFunction;
+ friend class PageUpImeUiFunction;
+ friend class PageDownImeUiFunction;
+ friend class RegisterImeUiFunction;
+ friend struct DefaultSingletonTraits<ExtensionImeUiEventRouter>;
+
+ ExtensionImeUiEventRouter();
+ virtual ~ExtensionImeUiEventRouter();
+
+ void Register(Profile* profile, const std::string& extension_id);
+ void CandidateClicked(Profile* profile,
+ const std::string& extension_id, int index, int button);
+ void CursorUp(Profile* profile, const std::string& extension_id);
+ void CursorDown(Profile* profile, const std::string& extension_id);
+ void PageUp(Profile* profile, const std::string& extension_id);
+ void PageDown(Profile* profile, const std::string& extension_id);
+
+ void OnHideAuxiliaryText();
+ void OnHideLookupTable();
+ void OnSetCursorLocation(int x, int y, int width, int height);
+ void OnUpdateAuxiliaryText(const std::string& utf8_text);
+ void OnUpdateLookupTable(
+ const chromeos::InputMethodLookupTable& lookup_table);
+
+ void DispatchEvent(Profile* profile,
+ const char* event_name,
+ const std::string& json_args);
+
+ Profile* profile_;
+ std::string extension_id_;
+ ImeUiController* ime_ui_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionImeUiEventRouter);
+};
+
+// Base class for input APIs.
+class ImeUiFunction : public AsyncExtensionFunction {
Yusuke Sato 2011/04/18 08:21:29 The ImeUiFunction class looks exactly the same as
Peng 2011/04/18 14:35:38 Done.
+ public:
+ virtual void Run();
+ virtual bool RunImpl() = 0;
+};
+
+// Note that this experimental API is currently only available for
+// TOOLKIT_VIEWS (see chrome/chrome_browser.gypi).
+//
+// We may eventually support other platforms by adding the necessary
+// synthetic event distribution code to this Function.
+class RegisterImeUiFunction : public ImeUiFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.register");
+};
+
+class CandidateClickedImeUiFunction : public ImeUiFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.candidateClicked");
+};
+
+class CursorUpImeUiFunction : public ImeUiFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.cursorUp");
+};
+
+class CursorDownImeUiFunction : public ImeUiFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.cursorDown");
+};
+
+class PageUpImeUiFunction : public ImeUiFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.pageUp");
+};
+
+class PageDownImeUiFunction : public ImeUiFunction {
+ public:
+ virtual bool RunImpl();
+ DECLARE_EXTENSION_FUNCTION_NAME("experimental.ime.ui.pageDown");
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_IME_UI_API_H_

Powered by Google App Engine
This is Rietveld 408576698