summaryrefslogtreecommitdiffstats
path: root/chrome/common/render_messages.h
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-17 00:30:18 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-17 00:30:18 +0000
commit155f35e6495385739f54e457374cf7d00c741a22 (patch)
tree69f910dc9f247e6961edef40b13f39c190ca686b /chrome/common/render_messages.h
parent273fb9c93ae61f45c6455b17d357ba5aca6b7e22 (diff)
downloadchromium_src-155f35e6495385739f54e457374cf7d00c741a22.zip
chromium_src-155f35e6495385739f54e457374cf7d00c741a22.tar.gz
chromium_src-155f35e6495385739f54e457374cf7d00c741a22.tar.bz2
Implement IsSearchProviderInstalled and a test for it.
It is currently off by default and one must pass in a flag (--enable-search-provider-api-v2) to use it. Api details are in the bug. BUG=38475 TEST=ui_tests --gtest_filter=SearchProviderTest.TestIsSearchProviderInstalled Review URL: http://codereview.chromium.org/2823042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/render_messages.h')
-rw-r--r--chrome/common/render_messages.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 08b5518..5c3370c 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -147,6 +147,56 @@ struct ViewMsg_StopFinding_Params {
Action action;
};
+// The install state of the search provider (not installed, installed, default).
+struct ViewHostMsg_GetSearchProviderInstallState_Params {
+ enum State {
+ // Equates to an access denied error.
+ DENIED = -1,
+
+ // DON'T CHANGE THE VALUES BELOW.
+ // All of the following values are manidated by the
+ // spec for window.external.IsSearchProviderInstalled.
+
+ // The search provider is not installed.
+ NOT_INSTALLED = 0,
+
+ // The search provider is in the user's set but is not
+ INSTALLED_BUT_NOT_DEFAULT = 1,
+
+ // The search provider is set as the user's default.
+ INSTALLED_AS_DEFAULT = 2
+ };
+ State state;
+
+ ViewHostMsg_GetSearchProviderInstallState_Params()
+ : state(DENIED) {
+ }
+
+ explicit ViewHostMsg_GetSearchProviderInstallState_Params(State s)
+ : state(s) {
+ }
+
+ static ViewHostMsg_GetSearchProviderInstallState_Params Denied() {
+ return ViewHostMsg_GetSearchProviderInstallState_Params(DENIED);
+ }
+
+ static ViewHostMsg_GetSearchProviderInstallState_Params NotInstalled() {
+ return ViewHostMsg_GetSearchProviderInstallState_Params(NOT_INSTALLED);
+ }
+
+ static ViewHostMsg_GetSearchProviderInstallState_Params
+ InstallButNotDefault() {
+ return ViewHostMsg_GetSearchProviderInstallState_Params(
+ INSTALLED_BUT_NOT_DEFAULT);
+ }
+
+ static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() {
+ return ViewHostMsg_GetSearchProviderInstallState_Params(
+ INSTALLED_AS_DEFAULT);
+ }
+};
+
+
// Parameters structure for ViewHostMsg_FrameNavigate, which has too many data
// parameters to be reasonably put in a predefined IPC message.
struct ViewHostMsg_FrameNavigate_Params {
@@ -949,6 +999,49 @@ struct ParamTraits<FontDescriptor> {
}
};
+// Traits for ViewHostMsg_GetSearchProviderInstallState_Params structure to
+// pack/unpack.
+template <>
+struct ParamTraits<ViewHostMsg_GetSearchProviderInstallState_Params> {
+ typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ m->WriteInt(p.state);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ int type;
+ if (!m->ReadInt(iter, &type))
+ return false;
+ p->state = static_cast<param_type::State>(type);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ std::wstring state;
+ switch (p.state) {
+ case ViewHostMsg_GetSearchProviderInstallState_Params::DENIED:
+ state = L"ViewHostMsg_GetSearchProviderInstallState_Params::DENIED";
+ break;
+ case ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED:
+ state =
+ L"ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED";
+ break;
+ case ViewHostMsg_GetSearchProviderInstallState_Params::
+ INSTALLED_BUT_NOT_DEFAULT:
+ state = L"ViewHostMsg_GetSearchProviderInstallState_Params::"
+ L"INSTALLED_BUT_NOT_DEFAULT";
+ break;
+ case ViewHostMsg_GetSearchProviderInstallState_Params::
+ INSTALLED_AS_DEFAULT:
+ state = L"ViewHostMsg_GetSearchProviderInstallState_Params::"
+ L"INSTALLED_AS_DEFAULT";
+ break;
+ default:
+ state = L"UNKNOWN";
+ break;
+ }
+ LogParam(state, l);
+ }
+};
+
// Traits for ViewHostMsg_FrameNavigate_Params structure to pack/unpack.
template <>
struct ParamTraits<ViewHostMsg_FrameNavigate_Params> {