Commit 779e754b authored by bshe@chromium.org's avatar bshe@chromium.org

Add chrome.virtualKeyboardPrivate.openSettings api to open settings page


This will open chrome://settings/languages page after called.

BUG=

Review URL: https://codereview.chromium.org/342573002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278439 0039d316-1c4b-4281-b951-d872f2087c98
parent fb59672a
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/user_metrics.h" #include "content/public/browser/user_metrics.h"
#include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_function_registry.h"
...@@ -162,6 +165,19 @@ bool VirtualKeyboardPrivateGetKeyboardConfigFunction::RunSync() { ...@@ -162,6 +165,19 @@ bool VirtualKeyboardPrivateGetKeyboardConfigFunction::RunSync() {
#endif #endif
} }
bool VirtualKeyboardPrivateOpenSettingsFunction::RunSync() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
#if defined(USE_ASH)
content::RecordAction(base::UserMetricsAction("OpenLanguageOptionsDialog"));
chrome::ShowSettingsSubPageForProfile(
ProfileManager::GetActiveUserProfile(), chrome::kLanguageOptionsSubPage);
return true;
#else
error_ = kNotYetImplementedError;
return false;
#endif
}
InputAPI::InputAPI(content::BrowserContext* context) {} InputAPI::InputAPI(content::BrowserContext* context) {}
InputAPI::~InputAPI() { InputAPI::~InputAPI() {
......
...@@ -109,6 +109,20 @@ class VirtualKeyboardPrivateGetKeyboardConfigFunction ...@@ -109,6 +109,20 @@ class VirtualKeyboardPrivateGetKeyboardConfigFunction
virtual bool RunSync() OVERRIDE; virtual bool RunSync() OVERRIDE;
}; };
class VirtualKeyboardPrivateOpenSettingsFunction
: public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.openSettings",
VIRTUALKEYBOARDPRIVATE_OPENSETTINGS);
protected:
virtual ~VirtualKeyboardPrivateOpenSettingsFunction() {}
// ExtensionFunction:
virtual bool RunSync() OVERRIDE;
};
class InputAPI : public BrowserContextKeyedAPI { class InputAPI : public BrowserContextKeyedAPI {
public: public:
explicit InputAPI(content::BrowserContext* context); explicit InputAPI(content::BrowserContext* context);
......
...@@ -149,6 +149,13 @@ ...@@ -149,6 +149,13 @@
] ]
} }
] ]
},
{
"name": "openSettings",
"type": "function",
"description": "Opens chrome://settings/languages page.",
"parameters": [
]
} }
], ],
"events": [ "events": [
......
...@@ -850,6 +850,7 @@ enum HistogramValue { ...@@ -850,6 +850,7 @@ enum HistogramValue {
INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD, INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD,
INPUTMETHODPRIVATE_GETINPUTMETHODS, INPUTMETHODPRIVATE_GETINPUTMETHODS,
IDENTITY_GETPROFILEUSERINFO, IDENTITY_GETPROFILEUSERINFO,
VIRTUALKEYBOARDPRIVATE_OPENSETTINGS,
// Last entry: Add new entries above and ensure to update // Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms/histograms.xml. // tools/metrics/histograms/histograms/histograms.xml.
ENUM_BOUNDARY ENUM_BOUNDARY
......
...@@ -36585,6 +36585,7 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -36585,6 +36585,7 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="789" label="INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD"/> <int value="789" label="INPUTMETHODPRIVATE_SETCURRENTINPUTMETHOD"/>
<int value="790" label="INPUTMETHODPRIVATE_GETINPUTMETHODS"/> <int value="790" label="INPUTMETHODPRIVATE_GETINPUTMETHODS"/>
<int value="791" label="IDENTITY_GETPROFILEUSERINFO"/> <int value="791" label="IDENTITY_GETPROFILEUSERINFO"/>
<int value="792" label="VIRTUALKEYBOARDPRIVATE_OPENSETTINGS"/>
</enum> </enum>
<enum name="ExtensionInstallCause" type="int"> <enum name="ExtensionInstallCause" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment