alternate ntp: implement searchbox api for instant overlay to adopt themes

- add SearchBoxExtensionWrapper::GetThemeBackgroundInfo
  * returns theme background info: color, image url, image horizontal alignment, image vertical alignment, image tiling and image height
  * color is always filled, the rest are only filled if the theme has a custom background image that overlay needs to draw
  * should only be called when overlay is in ntp mode
  * when theme changes in ntp mode, BrowserInstantController caches the theme info; if mode is ntp, event is dispatched to onthemechanged callback, which should call GetThemeBackgroundInfo

- add SearchBoxExtensionWrapper::GetThemeAreaHeight
  * returns the height of the area that the entire theme background image should fill up
  * should only be called when overlay is in ntp mode and theme background image is not top-aligned; top-aligned images are always painted from overlay's top-left corner, so this value is irrelevant and will be invalid
  * change of this height is monitored when BrowserView lays out its children, then updated and cached in BrowserInstantController; if above conditions are met, event is dispatched to onthemeareaheightchanged callback, which should call GetThemeAreaHeight

- theme area height is also sent to preview when theme changes, 'cos the height may have changed with the previous theme but wasn't updated to preview

- theme info and area height are also sent to preview when search mode changes to ntp, 'cos they may have changed during the previous mode but not updated to preview

BUG=160957
TEST=the web page needs to be implemented before this can be manually tested


Review URL: https://chromiumcodereview.appspot.com/11413018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168908 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 500f7f3..db4cbca 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -119,6 +119,8 @@
 IPC_ENUM_TRAITS(InstantShownReason)
 IPC_ENUM_TRAITS(search_provider::OSDDType)
 IPC_ENUM_TRAITS(search_provider::InstallState)
+IPC_ENUM_TRAITS(ThemeBackgroundImageAlignment)
+IPC_ENUM_TRAITS(ThemeBackgroundImageTiling)
 IPC_ENUM_TRAITS(TranslateErrors::Type)
 IPC_ENUM_TRAITS(WebKit::WebConsoleMessage::Level)
 
@@ -173,6 +175,18 @@
   IPC_STRUCT_TRAITS_MEMBER(script_rules)
 IPC_STRUCT_TRAITS_END()
 
+IPC_STRUCT_TRAITS_BEGIN(ThemeBackgroundInfo)
+  IPC_STRUCT_TRAITS_MEMBER(color_r)
+  IPC_STRUCT_TRAITS_MEMBER(color_g)
+  IPC_STRUCT_TRAITS_MEMBER(color_b)
+  IPC_STRUCT_TRAITS_MEMBER(color_a)
+  IPC_STRUCT_TRAITS_MEMBER(theme_id)
+  IPC_STRUCT_TRAITS_MEMBER(image_horizontal_alignment)
+  IPC_STRUCT_TRAITS_MEMBER(image_vertical_alignment)
+  IPC_STRUCT_TRAITS_MEMBER(image_tiling)
+  IPC_STRUCT_TRAITS_MEMBER(image_height)
+IPC_STRUCT_TRAITS_END()
+
 IPC_STRUCT_TRAITS_BEGIN(WebKit::WebCache::ResourceTypeStat)
   IPC_STRUCT_TRAITS_MEMBER(count)
   IPC_STRUCT_TRAITS_MEMBER(size)
@@ -298,6 +312,12 @@
 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxActiveTabModeChanged,
                     bool /* active_tab_is_ntp */)
 
+IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxThemeChanged,
+                    ThemeBackgroundInfo /* value */)
+
+IPC_MESSAGE_ROUTED1(ChromeViewMsg_SearchBoxThemeAreaHeightChanged,
+                    int /* height */)
+
 // Toggles visual muting of the render view area. This is on when a constrained
 // window is showing.
 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetVisuallyDeemphasized,