Chromium Code Reviews| Index: chrome/common/render_messages.h |
| diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h |
| index 3a419cc266c89379ddb6e146920f1cd0ce1c5d1d..7fd8608b5bd0d8a473ea76600283b323e2f4e7a3 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) { |
|
sky
2010/07/15 23:24:49
indent 4
|
| + } |
| + |
| + explicit ViewHostMsg_GetSearchProviderInstallState_Params(State s) |
| + : state(s) { |
|
sky
2010/07/15 23:24:49
indent 4
|
| + } |
| + |
| + 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> { |