diff options
73 files changed, 870 insertions, 329 deletions
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 93b547d..496c3ce 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -27,40 +27,8 @@ <include name="IDR_ACCESSED_COOKIES" file="accessed_cookies.png" type="BINDATA" /> <include name="IDR_APP_DEFAULT_ICON" file="app_default_icon.png" type="BINDATA" /> <include name="IDR_APP_DROPARROW" file="app_droparrow.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_BACK" file="back.png" type="BINDATA" /> - <include name="IDR_BACK_D" file="back_d.png" type="BINDATA" /> - <include name="IDR_BACK_H" file="back_h.png" type="BINDATA" /> - <include name="IDR_BACK_P" file="back_p.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_BACK" file="large_back.png" type="BINDATA" /> - <include name="IDR_BACK_D" file="large_back_d.png" type="BINDATA" /> - <include name="IDR_BACK_H" file="large_back_h.png" type="BINDATA" /> - <include name="IDR_BACK_P" file="large_back_p.png" type="BINDATA" /> - </if> <include name="IDR_BALLOON_CLOSE" file="balloon_close.png" type="BINDATA" /> <include name="IDR_BALLOON_CLOSE_HOVER" file="balloon_close_hover.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_BALLOON_WRENCH" file="notification_wrench.png" type="BINDATA" /> - <include name="IDR_BALLOON_WRENCH_H" file="notification_wrench_h.png" type="BINDATA" /> - <include name="IDR_BALLOON_WRENCH_P" file="notification_wrench_p.png" type="BINDATA" /> - <include name="IDR_BLOCKED_COOKIES" file="blocked_cookies.png" type="BINDATA" /> - <include name="IDR_BLOCKED_IMAGES" file="blocked_images.png" type="BINDATA" /> - <include name="IDR_BLOCKED_JAVASCRIPT" file="blocked_script.png" type="BINDATA" /> - <include name="IDR_BLOCKED_PLUGINS" file="blocked_plugins.png" type="BINDATA" /> - <include name="IDR_BLOCKED_POPUPS" file="blocked_popups.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_BALLOON_WRENCH" file="large_notification_wrench.png" type="BINDATA" /> - <include name="IDR_BALLOON_WRENCH_H" file="large_notification_wrench_h.png" type="BINDATA" /> - <include name="IDR_BALLOON_WRENCH_P" file="large_notification_wrench_p.png" type="BINDATA" /> - <include name="IDR_BLOCKED_COOKIES" file="large_blocked_cookies.png" type="BINDATA" /> - <include name="IDR_BLOCKED_IMAGES" file="large_blocked_images.png" type="BINDATA" /> - <include name="IDR_BLOCKED_JAVASCRIPT" file="large_blocked_script.png" type="BINDATA" /> - <include name="IDR_BLOCKED_PLUGINS" file="large_blocked_plugins.png" type="BINDATA" /> - <include name="IDR_BLOCKED_POPUPS" file="large_blocked_popups.png" type="BINDATA" /> - </if> <include name="IDR_BOOKMARKS_FAVICON" file="bookmarks_favicon.png" type="BINDATA" /> <include name="IDR_BOOKMARK_BAR_CHEVRONS" file="chevron.png" type="BINDATA" /> <if expr="os != 'darwin'"> @@ -69,59 +37,6 @@ <if expr="os == 'darwin'"> <include name="IDR_BOOKMARK_BAR_FOLDER" file="bookmark_bar_folder_mac.png" type="BINDATA" /> </if> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_BROWSER_ACTION" file="browser_action.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTION_H" file="browser_action_h.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTION_P" file="browser_action_p.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_BROWSER_ACTION" file="large_browser_action.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTION_H" file="large_browser_action_h.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTION_P" file="large_browser_action_p.png" type="BINDATA" /> - </if> - <if expr="os.find('win') == -1 and not pp_ifdef('touchui')"> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW" file="browser_actions_overflow.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW_H" file="browser_actions_overflow_h.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="browser_actions_overflow_p.png" type="BINDATA" /> - </if> - <if expr="os.find('win') == -1 and pp_ifdef('touchui')"> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW" file="large_browser_actions_overflow.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW_H" file="large_browser_actions_overflow_h.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="large_browser_actions_overflow_p.png" type="BINDATA" /> - </if> - <if expr="os.find('win') != -1"> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW" file="browser_actions_overflow_win.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW_H" file="browser_actions_overflow_win_h.png" type="BINDATA" /> - <include name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="browser_actions_overflow_win_p.png" type="BINDATA" /> - </if> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_BUBBLE_B" file="bubble_b.png" type="BINDATA" /> - <include name="IDR_BUBBLE_BL" file="bubble_bl.png" type="BINDATA" /> - <include name="IDR_BUBBLE_BR" file="bubble_br.png" type="BINDATA" /> - <include name="IDR_BUBBLE_B_ARROW" file="bubble_pointer_b.png" type="BINDATA" /> - <include name="IDR_BUBBLE_L" file="bubble_l.png" type="BINDATA" /> - <include name="IDR_BUBBLE_L_ARROW" file="bubble_pointer_l.png" type="BINDATA" /> - <include name="IDR_BUBBLE_R" file="bubble_r.png" type="BINDATA" /> - <include name="IDR_BUBBLE_R_ARROW" file="bubble_pointer_r.png" type="BINDATA" /> - <include name="IDR_BUBBLE_T" file="bubble_t.png" type="BINDATA" /> - <include name="IDR_BUBBLE_TL" file="bubble_tl.png" type="BINDATA" /> - <include name="IDR_BUBBLE_TR" file="bubble_tr.png" type="BINDATA" /> - <include name="IDR_BUBBLE_T_ARROW" file="bubble_pointer_t.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_BUBBLE_B" file="large_bubble_b.png" type="BINDATA" /> - <include name="IDR_BUBBLE_BL" file="large_bubble_bl.png" type="BINDATA" /> - <include name="IDR_BUBBLE_BR" file="large_bubble_br.png" type="BINDATA" /> - <include name="IDR_BUBBLE_B_ARROW" file="large_bubble_pointer_b.png" type="BINDATA" /> - <include name="IDR_BUBBLE_L" file="large_bubble_l.png" type="BINDATA" /> - <include name="IDR_BUBBLE_L_ARROW" file="large_bubble_pointer_l.png" type="BINDATA" /> - <include name="IDR_BUBBLE_R" file="large_bubble_r.png" type="BINDATA" /> - <include name="IDR_BUBBLE_R_ARROW" file="large_bubble_pointer_r.png" type="BINDATA" /> - <include name="IDR_BUBBLE_T" file="large_bubble_t.png" type="BINDATA" /> - <include name="IDR_BUBBLE_TL" file="large_bubble_tl.png" type="BINDATA" /> - <include name="IDR_BUBBLE_TR" file="large_bubble_tr.png" type="BINDATA" /> - <include name="IDR_BUBBLE_T_ARROW" file="large_bubble_pointer_t.png" type="BINDATA" /> - </if> <include name="IDR_CLOSE_BAR" file="close_bar.png" type="BINDATA" /> <include name="IDR_CLOSE_BAR_H" file="close_bar_h.png" type="BINDATA" /> <include name="IDR_CLOSE_BAR_MASK" file="close_bar_mask.png" type="BINDATA" /> @@ -140,20 +55,6 @@ <include name="IDR_CONSTRAINED_TOP_CENTER_V" file="constrained_top_center_v.png" type="BINDATA" /> <include name="IDR_CONSTRAINED_TOP_LEFT_CORNER_V" file="constrained_top_left_corner_v.png" type="BINDATA" /> <include name="IDR_CONSTRAINED_TOP_RIGHT_CORNER_V" file="constrained_top_right_corner_v.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_CONTENT_TOP_CENTER" file="content_top_center.png" type="BINDATA" /> - <include name="IDR_CONTENT_TOP_LEFT_CORNER" file="content_top_left_corner.png" type="BINDATA" /> - <include name="IDR_CONTENT_TOP_LEFT_CORNER_MASK" file="content_top_left_corner_mask.png" type="BINDATA" /> - <include name="IDR_CONTENT_TOP_RIGHT_CORNER" file="content_top_right_corner.png" type="BINDATA" /> - <include name="IDR_CONTENT_TOP_RIGHT_CORNER_MASK" file="content_top_right_corner_mask.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_CONTENT_TOP_CENTER" file="large_content_top_center.png" type="BINDATA" /> - <include name="IDR_CONTENT_TOP_LEFT_CORNER" file="large_content_top_left_corner.png" type="BINDATA" /> - <include name="IDR_CONTENT_TOP_LEFT_CORNER_MASK" file="large_content_top_left_corner_mask.png" type="BINDATA" /> - <include name="IDR_CONTENT_TOP_RIGHT_CORNER" file="large_content_top_right_corner.png" type="BINDATA" /> - <include name="IDR_CONTENT_TOP_RIGHT_CORNER_MASK" file="large_content_top_right_corner_mask.png" type="BINDATA" /> - </if> <include name="IDR_COOKIE_ICON" file="cookie.png" type="BINDATA" /> <include name="IDR_COOKIE_STORAGE_ICON" file="cookie_storage.png" type="BINDATA" /> <if expr="pp_ifdef('_google_chrome')"> @@ -213,16 +114,6 @@ <include name="IDR_DOWNLOAD_PROGRESS_FOREGROUND_32" file="download_progress_foreground32.png" type="BINDATA" /> <include name="IDR_EXTENSION_DEFAULT_ICON" file="extension_default_icon.png" type="BINDATA" /> <include name="IDR_EXTENSIONS_SECTION" file="extensions_section.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_FEEDBACK" file="feedback.png" type="BINDATA" /> - <include name="IDR_FEEDBACK_H" file="feedback_h.png" type="BINDATA" /> - <include name="IDR_FEEDBACK_P" file="feedback_p.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_FEEDBACK" file="large_feedback.png" type="BINDATA" /> - <include name="IDR_FEEDBACK_H" file="large_feedback_h.png" type="BINDATA" /> - <include name="IDR_FEEDBACK_P" file="large_feedback_p.png" type="BINDATA" /> - </if> <include name="IDR_FINDINPAGE_NEXT" file="find_next.png" type="BINDATA" /> <include name="IDR_FINDINPAGE_NEXT_H" file="find_next_h.png" type="BINDATA" /> <include name="IDR_FINDINPAGE_NEXT_P" file="find_next_d.png" type="BINDATA" /> @@ -238,34 +129,12 @@ <include name="IDR_FIND_DLG_MIDDLE_BACKGROUND" file="find_dlg_middle_bg.png" type="BINDATA" /> <include name="IDR_FIND_DLG_RIGHT_BACKGROUND" file="find_dlg_right_bg.png" type="BINDATA" /> <include name="IDR_FLAGS" file="flags.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_FORWARD" file="forward.png" type="BINDATA" /> - <include name="IDR_FORWARD_D" file="forward_d.png" type="BINDATA" /> - <include name="IDR_FORWARD_H" file="forward_h.png" type="BINDATA" /> - <include name="IDR_FORWARD_P" file="forward_p.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_FORWARD" file="large_forward.png" type="BINDATA" /> - <include name="IDR_FORWARD_D" file="large_forward_d.png" type="BINDATA" /> - <include name="IDR_FORWARD_H" file="large_forward_h.png" type="BINDATA" /> - <include name="IDR_FORWARD_P" file="large_forward_p.png" type="BINDATA" /> - </if> <include name="IDR_FROZEN_TAB_ICON" file="frozen_tab.png" type="BINDATA" /> <include name="IDR_FULLSCREEN_MENU_BUTTON" file="fullscreen_menu_button.png" type="BINDATA" /> <include name="IDR_GEOLOCATION_ALLOWED_LOCATIONBAR_ICON" file="geolocation_allowed_locationbar_icon.png" type="BINDATA" /> <include name="IDR_GEOLOCATION_DENIED_LOCATIONBAR_ICON" file="geolocation_denied_locationbar_icon.png" type="BINDATA" /> <include name="IDR_GEOLOCATION_INFOBAR_ICON" file="geolocation_infobar_icon.png" type="BINDATA" /> <include name="IDR_HISTORY_FAVICON" file="history_favicon.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_HOME" file="home.png" type="BINDATA" /> - <include name="IDR_HOME_H" file="home_h.png" type="BINDATA" /> - <include name="IDR_HOME_P" file="home_p.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_HOME" file="large_home.png" type="BINDATA" /> - <include name="IDR_HOME_H" file="large_home_h.png" type="BINDATA" /> - <include name="IDR_HOME_P" file="large_home_p.png" type="BINDATA" /> - </if> <if expr="os.find('win') != -1"> <include name="IDR_INCOMPATIBILITY_DOT_ACTIVE" file="incompatibility_dot_active.png" type="BINDATA" /> <include name="IDR_INCOMPATIBILITY_DOT_INACTIVE" file="incompatibility_dot_inactive.png" type="BINDATA" /> @@ -290,53 +159,17 @@ </if> <include name="IDR_INFO_BUBBLE_CLOSE" file="bubble_close.png" type="BINDATA" /> <include name="IDR_INPUT_ALERT" file="input_alert.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_KEYWORD_SEARCH_MAGNIFIER" file="keyword_search_magnifier.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_KEYWORD_SEARCH_MAGNIFIER" file="large_keyword_search_magnifier.png" type="BINDATA" /> - </if> <include name="IDR_KILLED_TAB" file="killtab.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_LOCATIONBG_C" file="omnibox_c.png" type="BINDATA" /> - <include name="IDR_LOCATIONBG_L" file="omnibox_l.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_LOCATIONBG_C" file="large_omnibox_c.png" type="BINDATA" /> - <include name="IDR_LOCATIONBG_L" file="large_omnibox_l.png" type="BINDATA" /> - </if> <include name="IDR_LOCATIONBG_POPUPMODE_CENTER" file="omnibox_popup_c.png" type="BINDATA" /> <include name="IDR_LOCATIONBG_POPUPMODE_EDGE" file="omnibox_popup_edge.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_LOCATIONBG_R" file="omnibox_r.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_LOCATIONBG_R" file="large_omnibox_r.png" type="BINDATA" /> - </if> <if expr="os != 'darwin'"> <include name="IDR_LOCATION_BAR_KEYWORD_HINT_TAB" file="keyword_hint_tab.png" type="BINDATA" /> </if> <if expr="os == 'darwin'"> <include name="IDR_LOCATION_BAR_KEYWORD_HINT_TAB" file="keyword_hint_tab_mac.png" type="BINDATA" /> </if> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_C" file="keyword_search_bubble_c.png" type="BINDATA" /> - <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_L" file="keyword_search_bubble_l.png" type="BINDATA" /> - <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R" file="keyword_search_bubble_r.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_C" file="large_keyword_search_bubble_c.png" type="BINDATA" /> - <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_L" file="large_keyword_search_bubble_l.png" type="BINDATA" /> - <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R" file="large_keyword_search_bubble_r.png" type="BINDATA" /> - </if> <include name="IDR_MAXIMIZE_BUTTON_MASK" file="maximize_button_mask.png" type="BINDATA" /> <include name="IDR_MINIMIZE_BUTTON_MASK" file="minimize_button_mask.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_NEWTAB_BUTTON" file="newtab.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_NEWTAB_BUTTON" file="large_newtab.png" type="BINDATA" /> - </if> <include name="IDR_NEWTAB_BUTTON_H" file="newtab_h.png" type="BINDATA" /> <include name="IDR_NEWTAB_BUTTON_MASK" file="newtab_button_mask.png" type="BINDATA" /> <include name="IDR_NEWTAB_BUTTON_P" file="newtab_p.png" type="BINDATA" /> @@ -350,16 +183,6 @@ <include name="IDR_NEWTAB_OPTION_P" file="ntp_option_p.png" type="BINDATA" /> <include name="IDR_NEWTAB_THEMES_GALLERY_FAVICON" file="ntp_themes_gallery_favicon.png" type="BINDATA" /> <include name="IDR_NEWTAB_THEMES_GALLERY_THUMBNAIL" file="ntp_themes_gallery_thumb.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_C" file="ev_bubble_c.png" type="BINDATA" /> - <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_L" file="ev_bubble_l.png" type="BINDATA" /> - <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_R" file="ev_bubble_r.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_C" file="large_ev_bubble_c.png" type="BINDATA" /> - <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_L" file="large_ev_bubble_l.png" type="BINDATA" /> - <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_R" file="large_ev_bubble_r.png" type="BINDATA" /> - </if> <include name="IDR_OMNIBOX_EXTENSION_APP" file="omnibox_extension_app.png" type="BINDATA" /> <include name="IDR_OMNIBOX_EXTENSION_APP_DARK" file="omnibox_extension_app_dark.png" type="BINDATA" /> <include name="IDR_OMNIBOX_EXTENSION_APP_SELECTED" file="omnibox_extension_app_selected.png" type="BINDATA" /> @@ -411,16 +234,6 @@ <include name="IDR_PROFILE_TAG_INACTIVE_CENTER" file="profile_tag_inactive_center.png" type="BINDATA" /> <include name="IDR_PROFILE_TAG_INACTIVE_LEFT" file="profile_tag_inactive_left.png" type="BINDATA" /> <include name="IDR_PROFILE_TAG_INACTIVE_RIGHT" file="profile_tag_inactive_right.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_RELOAD" file="reload.png" type="BINDATA" /> - <include name="IDR_RELOAD_H" file="reload_h.png" type="BINDATA" /> - <include name="IDR_RELOAD_P" file="reload_p.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_RELOAD" file="large_reload.png" type="BINDATA" /> - <include name="IDR_RELOAD_H" file="large_reload_h.png" type="BINDATA" /> - <include name="IDR_RELOAD_P" file="large_reload_p.png" type="BINDATA" /> - </if> <include name="IDR_RESTORE_BUTTON_MASK" file="restore_button_mask.png" type="BINDATA" /> <include name="IDR_SAD_FAVICON" file="sadfavicon.png" type="BINDATA" /> <include name="IDR_SAD_TAB" file="sadtab.png" type="BINDATA" /> @@ -502,14 +315,6 @@ <include name="IDR_SPEECH_INPUT_MIC_FULL" file="speech_input_mic_full.png" type="BINDATA" /> <include name="IDR_SPEECH_INPUT_MIC_MASK" file="speech_input_mic_mask.png" type="BINDATA" /> <include name="IDR_SPEECH_INPUT_SPINNER" file="speech_input_spinner.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_STAR" file="star.png" type="BINDATA" /> - <include name="IDR_STAR_LIT" file="star_lit.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_STAR" file="large_star.png" type="BINDATA" /> - <include name="IDR_STAR_LIT" file="large_star_lit.png" type="BINDATA" /> - </if> <if expr="pp_ifdef('_google_chrome') and (os == 'darwin')"> <include name="IDR_STATUS_TRAY_ICON" file="google_chrome/product_logo_22_mono.png" type="BINDATA" /> <include name="IDR_STATUS_TRAY_ICON_PRESSED" file="google_chrome/product_logo_22_mono_invert.png" type="BINDATA" /> @@ -526,18 +331,6 @@ <include name="IDR_STATUS_TRAY_ICON" file="chromium/product_logo_22.png" type="BINDATA" /> <include name="IDR_STATUS_TRAY_ICON_PRESSED" file="chromium/product_logo_22.png" type="BINDATA" /> </if> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_STOP" file="stop.png" type="BINDATA" /> - <include name="IDR_STOP_D" file="stop_d.png" type="BINDATA" /> - <include name="IDR_STOP_H" file="stop_h.png" type="BINDATA" /> - <include name="IDR_STOP_P" file="stop_p.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_STOP" file="large_stop.png" type="BINDATA" /> - <include name="IDR_STOP_D" file="large_stop_d.png" type="BINDATA" /> - <include name="IDR_STOP_H" file="large_stop_h.png" type="BINDATA" /> - <include name="IDR_STOP_P" file="large_stop_p.png" type="BINDATA" /> - </if> <if expr="os == 'darwin'"> <include name="IDR_TABPOSE_CLOSE" file="tabpose_close.png" type="BINDATA" /> </if> @@ -556,19 +349,12 @@ <include name="IDR_TAB_INACTIVE_LEFT" file="tab_inactive_left.png" type="BINDATA" /> <include name="IDR_TAB_INACTIVE_RIGHT" file="tab_inactive_right.png" type="BINDATA" /> <include name="IDR_THEME_BUTTON_BACKGROUND" file="notused.png" type="BINDATA" /> - <if expr="pp_ifdef('chromeos') and not pp_ifdef('touchui')"> - <include name="IDR_THEME_FRAME" file="theme_frame_default2.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('chromeos') and pp_ifdef('touchui')"> - <include name="IDR_THEME_FRAME" file="large_theme_frame_default2.png" type="BINDATA" /> - </if> <if expr="pp_ifdef('chromeos')"> <include name="IDR_THEME_FRAME_INACTIVE" file="theme_frame_default_inactive2.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INCOGNITO" file="theme_frame_default_incognito2.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="theme_frame_default_incognito_inactive2.png" type="BINDATA" /> </if> <if expr="not pp_ifdef('chromeos')"> - <include name="IDR_THEME_FRAME" file="theme_frame_default.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INACTIVE" file="theme_frame_default_inactive.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INCOGNITO" file="theme_frame_default_incognito.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="theme_frame_default_incognito_inactive.png" type="BINDATA" /> @@ -577,45 +363,11 @@ <include name="IDR_THEME_FRAME_OVERLAY_INACTIVE" file="notused.png" type="BINDATA" /> <include name="IDR_THEME_NTP_ATTRIBUTION" file="notused.png" type="BINDATA" /> <include name="IDR_THEME_NTP_BACKGROUND" file="ntp_background.png" type="BINDATA" /> - <if expr="pp_ifdef('chromeos') and not pp_ifdef('touchui')"> - <include name="IDR_THEME_TAB_BACKGROUND" file="theme_tab_background2.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('chromeos') and pp_ifdef('touchui')"> - <include name="IDR_THEME_TAB_BACKGROUND" file="large_theme_tab_background2.png" type="BINDATA" /> - </if> - <if expr="not pp_ifdef('chromeos')"> - <include name="IDR_THEME_TAB_BACKGROUND" file="theme_tab_background.png" type="BINDATA" /> - </if> <include name="IDR_THEME_TAB_BACKGROUND_INCOGNITO" file="theme_tab_background_incognito.png" type="BINDATA" /> <include name="IDR_THEME_TAB_BACKGROUND_V" file="theme_tab_background_glass.png" type="BINDATA" /> - <if expr="pp_ifdef('chromeos') and not pp_ifdef('touchui')"> - <include name="IDR_THEME_TOOLBAR" file="theme_toolbar_default2.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('chromeos') and pp_ifdef('touchui')"> - <include name="IDR_THEME_TOOLBAR" file="large_theme_toolbar_default2.png" type="BINDATA" /> - </if> - <if expr="not pp_ifdef('chromeos')"> - <include name="IDR_THEME_TOOLBAR" file="theme_toolbar_default.png" type="BINDATA" /> - </if> <include name="IDR_THEME_WINDOW_CONTROL_BACKGROUND" file="notused.png" type="BINDATA" /> <include name="IDR_THROBBER_LIGHT" file="throbber_light.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_THROBBER_WAITING" file="throbber_waiting.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_THROBBER_WAITING" file="large_throbber_waiting.png" type="BINDATA" /> - </if> <include name="IDR_THROBBER_WAITING_LIGHT" file="throbber_waiting_light.png" type="BINDATA" /> - <if expr="not pp_ifdef('touchui')"> - <include name="IDR_TOOLS" file="tools.png" type="BINDATA" /> - <include name="IDR_TOOLS_H" file="tools_h.png" type="BINDATA" /> - <include name="IDR_TOOLS_P" file="tools_p.png" type="BINDATA" /> - </if> - <if expr="pp_ifdef('touchui')"> - <include name="IDR_TOOLS" file="large_tools.png" type="BINDATA" /> - <include name="IDR_TOOLS_H" file="large_tools_h.png" type="BINDATA" /> - <include name="IDR_TOOLS_P" file="large_tools_p.png" type="BINDATA" /> - </if> <include name="IDR_UPDATE_AVAILABLE" file="update_available.png" type="BINDATA" /> <include name="IDR_UPDATE_BADGE" file="update_badge.png" type="BINDATA" /> <include name="IDR_UPDATE_BADGE2" file="update_badge2.png" type="BINDATA" /> diff --git a/chrome/app/theme/theme_resources_large.grd b/chrome/app/theme/theme_resources_large.grd new file mode 100644 index 0000000..0c8e5f8 --- /dev/null +++ b/chrome/app/theme/theme_resources_large.grd @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grit latest_public_release="0" current_release="1"> + <outputs> + <output filename="grit/theme_resources_large.h" type="rc_header"> + <emit emit_type='prepend'></emit> + </output> + <output filename="grit/theme_resources_large_map.cc" type="resource_map_source" /> + <output filename="grit/theme_resources_large_map.h" type="resource_map_header" /> + <output filename="theme_resources_large.pak" type="data_package" /> + <output filename="theme_resources_large.rc" type="rc_all" /> + </outputs> + <release seq="1"> + <includes> + <!-- KEEP THESE IN ALPHABETICAL ORDER AND SYNCHRONIZED WITH + theme_resources_standard.grd. THIS MEANS THAT EACH ICON IN THIS FILE + MUST HAVE AN EQUIVALENT ICON IN THE OTHER FILE.--> + <include name="IDR_BACK" file="large_back.png" type="BINDATA" /> + <include name="IDR_BACK_D" file="large_back_d.png" type="BINDATA" /> + <include name="IDR_BACK_H" file="large_back_h.png" type="BINDATA" /> + <include name="IDR_BACK_P" file="large_back_p.png" type="BINDATA" /> + <include name="IDR_BALLOON_WRENCH" file="large_notification_wrench.png" type="BINDATA" /> + <include name="IDR_BALLOON_WRENCH_H" file="large_notification_wrench_h.png" type="BINDATA" /> + <include name="IDR_BALLOON_WRENCH_P" file="large_notification_wrench_p.png" type="BINDATA" /> + <include name="IDR_BLOCKED_COOKIES" file="large_blocked_cookies.png" type="BINDATA" /> + <include name="IDR_BLOCKED_IMAGES" file="large_blocked_images.png" type="BINDATA" /> + <include name="IDR_BLOCKED_JAVASCRIPT" file="large_blocked_script.png" type="BINDATA" /> + <include name="IDR_BLOCKED_PLUGINS" file="large_blocked_plugins.png" type="BINDATA" /> + <include name="IDR_BLOCKED_POPUPS" file="large_blocked_popups.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTION" file="large_browser_action.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTION_H" file="large_browser_action_h.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTION_P" file="large_browser_action_p.png" type="BINDATA" /> + <if expr="os.find('win') == -1"> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW" file="large_browser_actions_overflow.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW_H" file="large_browser_actions_overflow_h.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="large_browser_actions_overflow_p.png" type="BINDATA" /> + </if> + <if expr="os.find('win') != -1"> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW" file="browser_actions_overflow_win.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW_H" file="browser_actions_overflow_win_h.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="browser_actions_overflow_win_p.png" type="BINDATA" /> + </if> + <include name="IDR_BUBBLE_B" file="large_bubble_b.png" type="BINDATA" /> + <include name="IDR_BUBBLE_BL" file="large_bubble_bl.png" type="BINDATA" /> + <include name="IDR_BUBBLE_BR" file="large_bubble_br.png" type="BINDATA" /> + <include name="IDR_BUBBLE_B_ARROW" file="large_bubble_pointer_b.png" type="BINDATA" /> + <include name="IDR_BUBBLE_L" file="large_bubble_l.png" type="BINDATA" /> + <include name="IDR_BUBBLE_L_ARROW" file="large_bubble_pointer_l.png" type="BINDATA" /> + <include name="IDR_BUBBLE_R" file="large_bubble_r.png" type="BINDATA" /> + <include name="IDR_BUBBLE_R_ARROW" file="large_bubble_pointer_r.png" type="BINDATA" /> + <include name="IDR_BUBBLE_T" file="large_bubble_t.png" type="BINDATA" /> + <include name="IDR_BUBBLE_TL" file="large_bubble_tl.png" type="BINDATA" /> + <include name="IDR_BUBBLE_TR" file="large_bubble_tr.png" type="BINDATA" /> + <include name="IDR_BUBBLE_T_ARROW" file="large_bubble_pointer_t.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_CENTER" file="large_content_top_center.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_LEFT_CORNER" file="large_content_top_left_corner.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_LEFT_CORNER_MASK" file="large_content_top_left_corner_mask.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_RIGHT_CORNER" file="large_content_top_right_corner.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_RIGHT_CORNER_MASK" file="large_content_top_right_corner_mask.png" type="BINDATA" /> + <include name="IDR_FEEDBACK" file="large_feedback.png" type="BINDATA" /> + <include name="IDR_FEEDBACK_H" file="large_feedback_h.png" type="BINDATA" /> + <include name="IDR_FEEDBACK_P" file="large_feedback_p.png" type="BINDATA" /> + <include name="IDR_FORWARD" file="large_forward.png" type="BINDATA" /> + <include name="IDR_FORWARD_D" file="large_forward_d.png" type="BINDATA" /> + <include name="IDR_FORWARD_H" file="large_forward_h.png" type="BINDATA" /> + <include name="IDR_FORWARD_P" file="large_forward_p.png" type="BINDATA" /> + <include name="IDR_HOME" file="large_home.png" type="BINDATA" /> + <include name="IDR_HOME_H" file="large_home_h.png" type="BINDATA" /> + <include name="IDR_HOME_P" file="large_home_p.png" type="BINDATA" /> + <include name="IDR_KEYWORD_SEARCH_MAGNIFIER" file="large_keyword_search_magnifier.png" type="BINDATA" /> + <include name="IDR_LOCATIONBG_C" file="large_omnibox_c.png" type="BINDATA" /> + <include name="IDR_LOCATIONBG_L" file="large_omnibox_l.png" type="BINDATA" /> + <include name="IDR_LOCATIONBG_R" file="large_omnibox_r.png" type="BINDATA" /> + <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_C" file="large_keyword_search_bubble_c.png" type="BINDATA" /> + <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_L" file="large_keyword_search_bubble_l.png" type="BINDATA" /> + <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R" file="large_keyword_search_bubble_r.png" type="BINDATA" /> + <include name="IDR_NEWTAB_BUTTON" file="large_newtab.png" type="BINDATA" /> + <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_C" file="large_ev_bubble_c.png" type="BINDATA" /> + <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_L" file="large_ev_bubble_l.png" type="BINDATA" /> + <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_R" file="large_ev_bubble_r.png" type="BINDATA" /> + <include name="IDR_RELOAD" file="large_reload.png" type="BINDATA" /> + <include name="IDR_RELOAD_H" file="large_reload_h.png" type="BINDATA" /> + <include name="IDR_RELOAD_P" file="large_reload_p.png" type="BINDATA" /> + <include name="IDR_STAR" file="large_star.png" type="BINDATA" /> + <include name="IDR_STAR_LIT" file="large_star_lit.png" type="BINDATA" /> + <include name="IDR_STOP" file="large_stop.png" type="BINDATA" /> + <include name="IDR_STOP_D" file="large_stop_d.png" type="BINDATA" /> + <include name="IDR_STOP_H" file="large_stop_h.png" type="BINDATA" /> + <include name="IDR_STOP_P" file="large_stop_p.png" type="BINDATA" /> + <if expr="pp_ifdef('chromeos')"> + <include name="IDR_THEME_FRAME" file="large_theme_frame_default2.png" type="BINDATA" /> + </if> + <if expr="not pp_ifdef('chromeos')"> + <include name="IDR_THEME_FRAME" file="theme_frame_default.png" type="BINDATA" /> + </if> + <if expr="pp_ifdef('chromeos')"> + <include name="IDR_THEME_TAB_BACKGROUND" file="large_theme_tab_background2.png" type="BINDATA" /> + </if> + <if expr="not pp_ifdef('chromeos')"> + <include name="IDR_THEME_TAB_BACKGROUND" file="theme_tab_background.png" type="BINDATA" /> + </if> + <if expr="pp_ifdef('chromeos')"> + <include name="IDR_THEME_TOOLBAR" file="large_theme_toolbar_default2.png" type="BINDATA" /> + </if> + <if expr="not pp_ifdef('chromeos')"> + <include name="IDR_THEME_TOOLBAR" file="theme_toolbar_default.png" type="BINDATA" /> + </if> + <include name="IDR_THROBBER_WAITING" file="large_throbber_waiting.png" type="BINDATA" /> + <include name="IDR_TOOLS" file="large_tools.png" type="BINDATA" /> + <include name="IDR_TOOLS_H" file="large_tools_h.png" type="BINDATA" /> + <include name="IDR_TOOLS_P" file="large_tools_p.png" type="BINDATA" /> + </includes> + </release> +</grit> diff --git a/chrome/app/theme/theme_resources_standard.grd b/chrome/app/theme/theme_resources_standard.grd new file mode 100644 index 0000000..d0ab636 --- /dev/null +++ b/chrome/app/theme/theme_resources_standard.grd @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grit latest_public_release="0" current_release="1"> + <outputs> + <output filename="grit/theme_resources_standard.h" type="rc_header"> + <emit emit_type='prepend'></emit> + </output> + <output filename="grit/theme_resources_standard_map.cc" type="resource_map_source" /> + <output filename="grit/theme_resources_standard_map.h" type="resource_map_header" /> + <output filename="theme_resources_standard.pak" type="data_package" /> + <output filename="theme_resources_standard.rc" type="rc_all" /> + </outputs> + <release seq="1"> + <includes> + <!-- KEEP THESE IN ALPHABETICAL ORDER AND SYNCHRONIZED WITH + theme_resources_large.grd. THIS MEANS THAT EACH ICON IN THIS FILE + MUST HAVE AN EQUIVALENT ICON IN THE OTHER FILE.--> + <include name="IDR_BACK" file="back.png" type="BINDATA" /> + <include name="IDR_BACK_D" file="back_d.png" type="BINDATA" /> + <include name="IDR_BACK_H" file="back_h.png" type="BINDATA" /> + <include name="IDR_BACK_P" file="back_p.png" type="BINDATA" /> + <include name="IDR_BALLOON_WRENCH" file="notification_wrench.png" type="BINDATA" /> + <include name="IDR_BALLOON_WRENCH_H" file="notification_wrench_h.png" type="BINDATA" /> + <include name="IDR_BALLOON_WRENCH_P" file="notification_wrench_p.png" type="BINDATA" /> + <include name="IDR_BLOCKED_COOKIES" file="blocked_cookies.png" type="BINDATA" /> + <include name="IDR_BLOCKED_IMAGES" file="blocked_images.png" type="BINDATA" /> + <include name="IDR_BLOCKED_JAVASCRIPT" file="blocked_script.png" type="BINDATA" /> + <include name="IDR_BLOCKED_PLUGINS" file="blocked_plugins.png" type="BINDATA" /> + <include name="IDR_BLOCKED_POPUPS" file="blocked_popups.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTION" file="browser_action.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTION_H" file="browser_action_h.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTION_P" file="browser_action_p.png" type="BINDATA" /> + <if expr="os.find('win') == -1"> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW" file="browser_actions_overflow.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW_H" file="browser_actions_overflow_h.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="browser_actions_overflow_p.png" type="BINDATA" /> + </if> + <if expr="os.find('win') != -1"> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW" file="browser_actions_overflow_win.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW_H" file="browser_actions_overflow_win_h.png" type="BINDATA" /> + <include name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="browser_actions_overflow_win_p.png" type="BINDATA" /> + </if> + <include name="IDR_BUBBLE_B" file="bubble_b.png" type="BINDATA" /> + <include name="IDR_BUBBLE_BL" file="bubble_bl.png" type="BINDATA" /> + <include name="IDR_BUBBLE_BR" file="bubble_br.png" type="BINDATA" /> + <include name="IDR_BUBBLE_B_ARROW" file="bubble_pointer_b.png" type="BINDATA" /> + <include name="IDR_BUBBLE_L" file="bubble_l.png" type="BINDATA" /> + <include name="IDR_BUBBLE_L_ARROW" file="bubble_pointer_l.png" type="BINDATA" /> + <include name="IDR_BUBBLE_R" file="bubble_r.png" type="BINDATA" /> + <include name="IDR_BUBBLE_R_ARROW" file="bubble_pointer_r.png" type="BINDATA" /> + <include name="IDR_BUBBLE_T" file="bubble_t.png" type="BINDATA" /> + <include name="IDR_BUBBLE_TL" file="bubble_tl.png" type="BINDATA" /> + <include name="IDR_BUBBLE_TR" file="bubble_tr.png" type="BINDATA" /> + <include name="IDR_BUBBLE_T_ARROW" file="bubble_pointer_t.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_CENTER" file="content_top_center.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_LEFT_CORNER" file="content_top_left_corner.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_LEFT_CORNER_MASK" file="content_top_left_corner_mask.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_RIGHT_CORNER" file="content_top_right_corner.png" type="BINDATA" /> + <include name="IDR_CONTENT_TOP_RIGHT_CORNER_MASK" file="content_top_right_corner_mask.png" type="BINDATA" /> + <include name="IDR_FEEDBACK" file="feedback.png" type="BINDATA" /> + <include name="IDR_FEEDBACK_H" file="feedback_h.png" type="BINDATA" /> + <include name="IDR_FEEDBACK_P" file="feedback_p.png" type="BINDATA" /> + <include name="IDR_FORWARD" file="forward.png" type="BINDATA" /> + <include name="IDR_FORWARD_D" file="forward_d.png" type="BINDATA" /> + <include name="IDR_FORWARD_H" file="forward_h.png" type="BINDATA" /> + <include name="IDR_FORWARD_P" file="forward_p.png" type="BINDATA" /> + <include name="IDR_HOME" file="home.png" type="BINDATA" /> + <include name="IDR_HOME_H" file="home_h.png" type="BINDATA" /> + <include name="IDR_HOME_P" file="home_p.png" type="BINDATA" /> + <include name="IDR_KEYWORD_SEARCH_MAGNIFIER" file="keyword_search_magnifier.png" type="BINDATA" /> + <include name="IDR_LOCATIONBG_C" file="omnibox_c.png" type="BINDATA" /> + <include name="IDR_LOCATIONBG_L" file="omnibox_l.png" type="BINDATA" /> + <include name="IDR_LOCATIONBG_R" file="omnibox_r.png" type="BINDATA" /> + <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_C" file="keyword_search_bubble_c.png" type="BINDATA" /> + <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_L" file="keyword_search_bubble_l.png" type="BINDATA" /> + <include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R" file="keyword_search_bubble_r.png" type="BINDATA" /> + <include name="IDR_NEWTAB_BUTTON" file="newtab.png" type="BINDATA" /> + <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_C" file="ev_bubble_c.png" type="BINDATA" /> + <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_L" file="ev_bubble_l.png" type="BINDATA" /> + <include name="IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_R" file="ev_bubble_r.png" type="BINDATA" /> + <include name="IDR_RELOAD" file="reload.png" type="BINDATA" /> + <include name="IDR_RELOAD_H" file="reload_h.png" type="BINDATA" /> + <include name="IDR_RELOAD_P" file="reload_p.png" type="BINDATA" /> + <include name="IDR_STAR" file="star.png" type="BINDATA" /> + <include name="IDR_STAR_LIT" file="star_lit.png" type="BINDATA" /> + <include name="IDR_STOP" file="stop.png" type="BINDATA" /> + <include name="IDR_STOP_D" file="stop_d.png" type="BINDATA" /> + <include name="IDR_STOP_H" file="stop_h.png" type="BINDATA" /> + <include name="IDR_STOP_P" file="stop_p.png" type="BINDATA" /> + <if expr="pp_ifdef('chromeos')"> + <include name="IDR_THEME_FRAME" file="theme_frame_default2.png" type="BINDATA" /> + </if> + <if expr="not pp_ifdef('chromeos')"> + <include name="IDR_THEME_FRAME" file="theme_frame_default.png" type="BINDATA" /> + </if> + <if expr="pp_ifdef('chromeos')"> + <include name="IDR_THEME_TAB_BACKGROUND" file="theme_tab_background2.png" type="BINDATA" /> + </if> + <if expr="not pp_ifdef('chromeos')"> + <include name="IDR_THEME_TAB_BACKGROUND" file="theme_tab_background.png" type="BINDATA" /> + </if> + <if expr="pp_ifdef('chromeos')"> + <include name="IDR_THEME_TOOLBAR" file="theme_toolbar_default2.png" type="BINDATA" /> + </if> + <if expr="not pp_ifdef('chromeos')"> + <include name="IDR_THEME_TOOLBAR" file="theme_toolbar_default.png" type="BINDATA" /> + </if> + <include name="IDR_THROBBER_WAITING" file="throbber_waiting.png" type="BINDATA" /> + <include name="IDR_TOOLS" file="tools.png" type="BINDATA" /> + <include name="IDR_TOOLS_H" file="tools_h.png" type="BINDATA" /> + <include name="IDR_TOOLS_P" file="tools_p.png" type="BINDATA" /> + </includes> + </release> +</grit> diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index fcd92f1..b2c0b48 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -20,6 +20,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "net/base/escape.h" #import "third_party/mozilla/NSPasteboard+Utils.h" #include "ui/base/clipboard/clipboard.h" diff --git a/chrome/browser/content_setting_image_model.cc b/chrome/browser/content_setting_image_model.cc index f8419d9..c092872 100644 --- a/chrome/browser/content_setting_image_model.cc +++ b/chrome/browser/content_setting_image_model.cc @@ -11,6 +11,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" class ContentSettingBlockedImageModel : public ContentSettingImageModel { diff --git a/chrome/browser/resources_util.cc b/chrome/browser/resources_util.cc index ab2fe9d..99a2743 100644 --- a/chrome/browser/resources_util.cc +++ b/chrome/browser/resources_util.cc @@ -9,6 +9,7 @@ #include "base/hash_tables.h" #include "base/lazy_instance.h" #include "grit/theme_resources_map.h" +#include "grit/theme_resources_standard_map.h" namespace { @@ -23,6 +24,10 @@ class ThemeMap { for (size_t i = 0; i < kThemeResourcesSize; ++i) { id_map_[kThemeResources[i].name] = kThemeResources[i].value; } + for (size_t i = 0; i < kThemeResourcesStandardSize; ++i) { + id_map_[kThemeResourcesStandard[i].name] = + kThemeResourcesStandard[i].value; + } } int GetId(const std::string& resource_name) { diff --git a/chrome/browser/resources_util_unittest.cc b/chrome/browser/resources_util_unittest.cc index 51651da..de3d0d8 100644 --- a/chrome/browser/resources_util_unittest.cc +++ b/chrome/browser/resources_util_unittest.cc @@ -5,6 +5,7 @@ #include "chrome/browser/resources_util.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "testing/gtest/include/gtest/gtest.h" namespace { diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 274cae3..4bdee1c 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -13,6 +13,7 @@ #include "content/browser/browser_thread.h" #include "grit/app_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "net/base/file_stream.h" #include "net/base/net_errors.h" #include "third_party/skia/include/core/SkCanvas.h" diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index 92dc94c..a94ed54 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -15,6 +15,7 @@ #include "content/browser/browser_thread.h" #include "content/common/json_value_serializer.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/color_utils.h" diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 5d1c60e..132208f 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -17,6 +17,7 @@ #include "content/common/notification_type.h" #include "grit/app_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/resource/resource_bundle.h" #if defined(OS_WIN) diff --git a/chrome/browser/themes/theme_service_mac.mm b/chrome/browser/themes/theme_service_mac.mm index 30d359e..c355e0d 100644 --- a/chrome/browser/themes/theme_service_mac.mm +++ b/chrome/browser/themes/theme_service_mac.mm @@ -10,7 +10,9 @@ #include "chrome/browser/themes/browser_theme_pack.h" #include "skia/ext/skia_utils_mac.h" #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" +#include "ui/base/resource/resource_bundle.h" #include "ui/gfx/color_utils.h" +#include "ui/gfx/image.h" NSString* const kBrowserThemeDidChangeNotification = @"BrowserThemeDidChangeNotification"; @@ -44,8 +46,16 @@ NSImage* ThemeService::GetNSImageNamed(int id, bool allow_default) const { // SkBitmap > native conversion? // - For consistency with other platforms. // - To get the generated tinted images. - SkBitmap* bitmap = GetBitmapNamed(id); - NSImage* nsimage = gfx::SkBitmapToNSImage(*bitmap); + NSImage* nsimage = nil; + if (theme_pack_.get()) { + SkBitmap* bitmap = theme_pack_->GetBitmapNamed(id); + if (bitmap) + nsimage = gfx::SkBitmapToNSImage(*bitmap); + } + + if (!nsimage) { + nsimage = rb_.GetNativeImageNamed(id); + } // We loaded successfully. Cache the image. if (nsimage) { diff --git a/chrome/browser/ui/cocoa/background_gradient_view.mm b/chrome/browser/ui/cocoa/background_gradient_view.mm index 4f808c8..936e3c0 100644 --- a/chrome/browser/ui/cocoa/background_gradient_view.mm +++ b/chrome/browser/ui/cocoa/background_gradient_view.mm @@ -8,6 +8,7 @@ #import "chrome/browser/ui/cocoa/nsview_additions.h" #import "chrome/browser/ui/cocoa/themed_window.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #define kToolbarTopOffset 12 #define kToolbarMaxHeight 100 diff --git a/chrome/browser/ui/cocoa/browser_frame_view.mm b/chrome/browser/ui/cocoa/browser_frame_view.mm index e487cc4..9e973c4 100644 --- a/chrome/browser/ui/cocoa/browser_frame_view.mm +++ b/chrome/browser/ui/cocoa/browser_frame_view.mm @@ -13,6 +13,7 @@ #import "chrome/browser/ui/cocoa/framed_browser_window.h" #import "chrome/browser/ui/cocoa/themed_window.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" static const CGFloat kBrowserFrameViewPaintHeight = 60.0; static const NSPoint kBrowserFrameViewPatternPhaseOffset = { -5, 3 }; diff --git a/chrome/browser/ui/cocoa/download/download_shelf_view.mm b/chrome/browser/ui/cocoa/download/download_shelf_view.mm index 3ab757c..0d9c72e 100644 --- a/chrome/browser/ui/cocoa/download/download_shelf_view.mm +++ b/chrome/browser/ui/cocoa/download/download_shelf_view.mm @@ -9,6 +9,7 @@ #import "chrome/browser/ui/cocoa/themed_window.h" #import "chrome/browser/ui/cocoa/view_id_util.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" @implementation DownloadShelfView diff --git a/chrome/browser/ui/cocoa/hover_image_button_unittest.mm b/chrome/browser/ui/cocoa/hover_image_button_unittest.mm index e25dc77..22faa22 100644 --- a/chrome/browser/ui/cocoa/hover_image_button_unittest.mm +++ b/chrome/browser/ui/cocoa/hover_image_button_unittest.mm @@ -8,6 +8,7 @@ #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" #import "chrome/browser/ui/cocoa/hover_image_button.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm b/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm index c3db857..b9d714e 100644 --- a/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.mm @@ -9,6 +9,7 @@ #import "chrome/browser/ui/cocoa/image_utils.h" #include "chrome/browser/ui/omnibox/location_bar_util.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util_mac.h" diff --git a/chrome/browser/ui/cocoa/location_bar/star_decoration.mm b/chrome/browser/ui/cocoa/location_bar/star_decoration.mm index 5ae432e..c3e1d48 100644 --- a/chrome/browser/ui/cocoa/location_bar/star_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/star_decoration.mm @@ -9,6 +9,7 @@ #include "chrome/browser/command_updater.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util_mac.h" namespace { diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index 32c97df..f38dcde 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -54,6 +54,7 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "skia/ext/skia_utils_mac.h" #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm index ecab140..bb86e3c 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_view.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm @@ -15,6 +15,7 @@ #import "chrome/browser/ui/cocoa/view_id_util.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" namespace { diff --git a/chrome/browser/ui/gtk/back_forward_button_gtk.cc b/chrome/browser/ui/gtk/back_forward_button_gtk.cc index c6c1a98..4b2a796 100644 --- a/chrome/browser/ui/gtk/back_forward_button_gtk.cc +++ b/chrome/browser/ui/gtk/back_forward_button_gtk.cc @@ -16,6 +16,7 @@ #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" // The time in milliseconds between when the user clicks and the menu appears. diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc index c89f3c8..9a72fba 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc @@ -34,6 +34,7 @@ #include "content/common/notification_type.h" #include "grit/app_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/gfx/canvas_skia_paint.h" #include "ui/gfx/gtk_util.h" diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc index 81cab17..7e22346 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.cc +++ b/chrome/browser/ui/gtk/browser_titlebar.cc @@ -38,6 +38,7 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/gtk_util.h" diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc index 2919160..d9bf268 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc @@ -46,6 +46,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/dragdrop/gtk_dnd_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/models/accelerator_gtk.h" diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 21010f0..ac24d2c 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -85,6 +85,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/gtk_util.h" diff --git a/chrome/browser/ui/gtk/gtk_theme_service.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc index 8e433d6..ced0710 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service.cc +++ b/chrome/browser/ui/gtk/gtk_theme_service.cc @@ -30,6 +30,7 @@ #include "content/common/notification_type.h" #include "grit/app_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc index 1f0b002..edd0022 100644 --- a/chrome/browser/ui/gtk/gtk_util.cc +++ b/chrome/browser/ui/gtk/gtk_util.cc @@ -32,6 +32,7 @@ #include "content/common/renderer_preferences.h" #include "googleurl/src/gurl.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 70c7c7b..0bbe026 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -54,6 +54,7 @@ #include "content/common/page_transition_types.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "net/base/net_util.h" #include "ui/base/dragdrop/gtk_dnd_util.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc index 82678b3..8e2ce41 100644 --- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc +++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc @@ -37,6 +37,7 @@ #include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/gtk/reload_button_gtk.cc b/chrome/browser/ui/gtk/reload_button_gtk.cc index fd001ca..0401f62 100644 --- a/chrome/browser/ui/gtk/reload_button_gtk.cc +++ b/chrome/browser/ui/gtk/reload_button_gtk.cc @@ -16,6 +16,7 @@ #include "content/common/notification_source.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" // The width of this button in GTK+ theme mode. The Stop and Refresh stock icons diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc index a3f792a..26ed8d4 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc @@ -22,6 +22,7 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/animation/throb_animation.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index d5241cd..8688b10 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -28,6 +28,7 @@ #include "content/common/notification_type.h" #include "grit/app_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/animation/animation_delegate.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/dragdrop/gtk_dnd_util.h" diff --git a/chrome/browser/ui/tests/ui_gfx_image_unittest.cc b/chrome/browser/ui/tests/ui_gfx_image_unittest.cc index cfe1c9b..7c8f100 100644 --- a/chrome/browser/ui/tests/ui_gfx_image_unittest.cc +++ b/chrome/browser/ui/tests/ui_gfx_image_unittest.cc @@ -6,7 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image.h" -#include "ui/gfx/image_unittest.h" +#include "ui/gfx/image_unittest_util.h" #if defined(OS_LINUX) #include <gtk/gtk.h> @@ -43,7 +43,7 @@ TEST(UiGfxImageTest, GtkImageView) { GtkWidget* fixed = gtk_fixed_new(); gtk_container_add(GTK_CONTAINER(window), fixed); - gfx::Image image(gfx::test::CreateBitmap()); + gfx::Image image(gfx::test::CreateBitmap(25, 25)); GtkWidget* image_view = gtk_image_new_from_pixbuf(image); gtk_fixed_put(GTK_FIXED(fixed), image_view, 10, 10); gtk_widget_set_size_request(image_view, 25, 25); diff --git a/chrome/browser/ui/tests/ui_gfx_image_unittest.mm b/chrome/browser/ui/tests/ui_gfx_image_unittest.mm index 9f62332..7245ff1 100644 --- a/chrome/browser/ui/tests/ui_gfx_image_unittest.mm +++ b/chrome/browser/ui/tests/ui_gfx_image_unittest.mm @@ -9,7 +9,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image.h" -#include "ui/gfx/image_unittest.h" +#include "ui/gfx/image_unittest_util.h" namespace { @@ -17,7 +17,7 @@ class UiGfxImageTest : public CocoaTest { }; TEST_F(UiGfxImageTest, CheckColor) { - gfx::Image image(gfx::test::CreateBitmap()); + gfx::Image image(gfx::test::CreateBitmap(25, 25)); [image lockFocus]; NSColor* color = NSReadPixel(NSMakePoint(10, 10)); [image unlockFocus]; @@ -42,7 +42,7 @@ TEST_F(UiGfxImageTest, ImageView) { [[test_window() contentView] addSubview:image_view]; [test_window() orderFront:nil]; - gfx::Image image(gfx::test::CreateBitmap()); + gfx::Image image(gfx::test::CreateBitmap(25, 25)); [image_view setImage:image]; } diff --git a/chrome/browser/ui/touch/tabs/touch_tab.cc b/chrome/browser/ui/touch/tabs/touch_tab.cc index e4ec73f..11d3b5b 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab.cc +++ b/chrome/browser/ui/touch/tabs/touch_tab.cc @@ -8,6 +8,7 @@ #include "chrome/browser/themes/theme_service.h" #include "grit/app_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/favicon_size.h" diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 3fd12be..942d92d 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -29,6 +29,8 @@ #include "content/common/notification_type.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" +#include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/effects/SkGradientShader.h" #include "ui/base/accessibility/accessible_view_state.h" @@ -45,8 +47,6 @@ #include "views/metrics.h" #include "views/window/window.h" -#include "grit/theme_resources.h" - // Horizontal spacing between most items in the container, as well as after the // last item or chevron (if visible). static const int kItemSpacing = ToolbarView::kStandardSpacing; diff --git a/chrome/browser/ui/views/bubble/bubble_border.cc b/chrome/browser/ui/views/bubble/bubble_border.cc index 1a05b17..98c3f3d 100644 --- a/chrome/browser/ui/views/bubble/bubble_border.cc +++ b/chrome/browser/ui/views/bubble/bubble_border.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index 24ad971..977bfd8 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -19,6 +19,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "net/base/net_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" diff --git a/chrome/browser/ui/views/detachable_toolbar_view.cc b/chrome/browser/ui/views/detachable_toolbar_view.cc index 5e92c489..04aa0d5 100644 --- a/chrome/browser/ui/views/detachable_toolbar_view.cc +++ b/chrome/browser/ui/views/detachable_toolbar_view.cc @@ -6,6 +6,7 @@ #include "chrome/browser/themes/theme_service.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkShader.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index 1f1d80c..31366ca 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -21,6 +21,7 @@ #include "content/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "third_party/skia/include/effects/SkGradientShader.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index 9fa33d5..69604e5 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc @@ -23,6 +23,7 @@ #include "content/common/notification_service.h" #include "grit/app_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/theme_provider.h" #include "ui/gfx/canvas_skia.h" diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index 3fb7a61..20616aa7 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -16,6 +16,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index cb193b8..a3f4b82 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -38,6 +38,7 @@ #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc index d531c43..8e24153 100644 --- a/chrome/browser/ui/views/location_bar/star_view.cc +++ b/chrome/browser/ui/views/location_bar/star_view.cc @@ -11,6 +11,7 @@ #include "chrome/browser/ui/views/browser_dialogs.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index ce59089..cdd4a5a 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -22,6 +22,7 @@ #include "content/common/notification_type.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/animation/slide_animation.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index 2e9f222..9368313 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -18,6 +18,7 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/animation_container.h" #include "ui/base/animation/slide_animation.h" diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index 424d052..bafe9a1 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -12,6 +12,7 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "third_party/skia/include/effects/SkGradientShader.h" #include "ui/base/animation/multi_animation.h" #include "ui/base/animation/slide_animation.h" diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index c3a187e..7ab2f3a 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -16,6 +16,7 @@ #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/animation/animation_container.h" #include "ui/base/dragdrop/drag_drop_types.h" diff --git a/chrome/browser/ui/views/theme_background.cc b/chrome/browser/ui/views/theme_background.cc index 6fd601b..982117a 100644 --- a/chrome/browser/ui/views/theme_background.cc +++ b/chrome/browser/ui/views/theme_background.cc @@ -11,6 +11,7 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "views/view.h" diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc index 4873458..803c336 100644 --- a/chrome/browser/ui/views/toolbar_view.cc +++ b/chrome/browser/ui/views/toolbar_view.cc @@ -23,6 +23,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/webui/theme_source_unittest.cc b/chrome/browser/ui/webui/theme_source_unittest.cc index ce994d6..1fde842 100644 --- a/chrome/browser/ui/webui/theme_source_unittest.cc +++ b/chrome/browser/ui/webui/theme_source_unittest.cc @@ -9,6 +9,7 @@ #include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "testing/gtest/include/gtest/gtest.h" // A mock ThemeSource (so we can override SendResponse to get at its data). diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 0a6beb5..3da3e29 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -240,6 +240,34 @@ 'includes': [ '../build/grit_target.gypi' ], }, { + 'target_name': 'theme_resources_large', + 'type': 'none', + 'actions': [ + { + 'action_name': 'theme_resources_large', + 'variables': { + 'grit_grd_file': 'app/theme/theme_resources_large.grd', + }, + 'includes': [ '../build/grit_action.gypi' ], + }, + ], + 'includes': [ '../build/grit_target.gypi' ], + }, + { + 'target_name': 'theme_resources_standard', + 'type': 'none', + 'actions': [ + { + 'action_name': 'theme_resources_standard', + 'variables': { + 'grit_grd_file': 'app/theme/theme_resources_standard.grd', + }, + 'includes': [ '../build/grit_action.gypi' ], + }, + ], + 'includes': [ '../build/grit_target.gypi' ], + }, + { 'target_name': 'platform_locale_settings', 'type': 'none', 'actions': [ @@ -355,6 +383,7 @@ 'chrome_strings', '../net/net.gyp:http_server', 'theme_resources', + 'theme_resources_standard', '../skia/skia.gyp:skia', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', @@ -1407,6 +1436,7 @@ 'msvs_guid': '1556EF78-C7E6-43C8-951F-F6B43AC0DD12', 'dependencies': [ 'theme_resources', + 'theme_resources_standard', '../base/base.gyp:test_support_base', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', @@ -1495,6 +1525,17 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.pak', ], + 'conditions': [ + ['touchui==0', { + 'pak_inputs': [ + '<(grit_out_dir)/theme_resources_standard.pak', + ], + }, { # else: touchui!=0 + 'pak_inputs': [ + '<(grit_out_dir)/theme_resources_large.pak', + ], + }], + ], }, 'inputs': [ '<(repack_path)', diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 41663ba..1487d62 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -24,6 +24,8 @@ 'safe_browsing_report_proto', 'syncapi', 'theme_resources', + 'theme_resources_large', + 'theme_resources_standard', 'userfeedback_proto', '../app/app.gyp:app_resources', '../build/temp_gyp/googleurl.gyp:googleurl', @@ -3416,6 +3418,8 @@ '<(grit_out_dir)/grit/devtools_resources_map.cc', '<(grit_out_dir)/grit/shared_resources_map.cc', '<(grit_out_dir)/grit/theme_resources_map.cc', + '<(grit_out_dir)/grit/theme_resources_large_map.cc', + '<(grit_out_dir)/grit/theme_resources_standard_map.cc', ], 'conditions': [ ['javascript_engine=="v8"', { diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 7720b0a..7a83814 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -106,6 +106,7 @@ 'default_plugin/default_plugin.gyp:default_plugin', 'safe_browsing_csd_proto', 'theme_resources', + 'theme_resources_standard', '../app/app.gyp:app_base', '../app/app.gyp:app_resources', '../base/base.gyp:base', diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index 46fd3ca..d200ad2 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -117,6 +117,7 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources_standard.rc', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', @@ -321,6 +322,7 @@ '<(grit_out_dir)/default_plugin_resources/default_plugin_resources.pak', '<(grit_out_dir)/renderer_resources.pak', '<(grit_out_dir)/theme_resources.pak', + '<(grit_out_dir)/theme_resources_standard.pak', '<(SHARED_INTERMEDIATE_DIR)/app/app_resources/app_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak', @@ -339,6 +341,24 @@ 'process_outputs_as_mac_bundle_resources': 1, }, { + 'action_name': 'repack_theme_resources_large', + 'variables': { + 'pak_inputs': [ + '<(grit_out_dir)/theme_resources_large.pak', + ], + }, + 'inputs': [ + '<(repack_path)', + '<@(pak_inputs)', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/repack/theme_resources_large.pak', + ], + 'action': ['python', '<(repack_path)', '<@(_outputs)', + '<@(pak_inputs)'], + 'process_outputs_as_mac_bundle_resources': 1, + }, + { 'action_name': 'repack_locales', 'process_outputs_as_mac_bundle_resources': 1, 'variables': { diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index b67c35e..04b5390 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -31,6 +31,7 @@ 'app/policy/cloud_policy_codegen.gyp:policy', 'browser/sync/protocol/sync_proto.gyp:sync_proto_cpp', 'theme_resources', + 'theme_resources_standard', '../base/base.gyp:test_support_base', '../content/content.gyp:content_gpu', '../ipc/ipc.gyp:test_support_ipc', @@ -189,6 +190,8 @@ '../content/browser/tab_contents/test_tab_contents.h', '../content/common/notification_observer_mock.cc', '../content/common/notification_observer_mock.h', + '../ui/gfx/image_unittest_util.h', + '../ui/gfx/image_unittest_util.cc', ], 'conditions': [ ['OS=="linux"', { @@ -212,6 +215,7 @@ 'chrome_resources', 'chrome_strings', 'theme_resources', + 'theme_resources_standard', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', ], @@ -351,6 +355,7 @@ 'test_support_common', 'test_support_ui', 'theme_resources', + 'theme_resources_standard', '../base/base.gyp:base', '../skia/skia.gyp:skia', '../third_party/libxml/libxml.gyp:libxml', @@ -537,6 +542,7 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources_standard.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome_dll_version/chrome_dll_version.rc', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', @@ -2082,6 +2088,7 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources_standard.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome_dll_version/chrome_dll_version.rc', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', @@ -2438,6 +2445,7 @@ '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources_standard.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', # TODO(alekseys): port sidebar to linux/mac. @@ -2591,6 +2599,7 @@ '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources_standard.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', ], @@ -2710,6 +2719,7 @@ 'test_support_common', 'test_support_ui', 'theme_resources', + 'theme_resources_standard', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', @@ -2812,6 +2822,7 @@ 'test_support_common', 'test_support_ui', 'theme_resources', + 'theme_resources_standard', '../base/base.gyp:base', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', @@ -2846,6 +2857,7 @@ 'test_support_common', 'test_support_ui', 'theme_resources', + 'theme_resources_standard', '../base/base.gyp:base', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', @@ -2875,6 +2887,7 @@ 'test_support_common', 'test_support_ui', 'theme_resources', + 'theme_resources_standard', '../base/base.gyp:base', '../net/net.gyp:net', '../skia/skia.gyp:skia', @@ -3162,6 +3175,7 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome_dll_version/chrome_dll_version.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources_standard.rc', ], 'include_dirs': [ '<(DEPTH)/third_party/wtl/include', @@ -3253,6 +3267,7 @@ '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources_standard.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome_dll_version/chrome_dll_version.rc', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc', @@ -3569,6 +3584,7 @@ 'chrome_resources', 'chrome_strings', 'theme_resources', + 'theme_resources_standard', '../skia/skia.gyp:skia', '../testing/gtest.gyp:gtest', ], diff --git a/skia/ext/skia_utils_mac.h b/skia/ext/skia_utils_mac.h index 0551643..04d4a1d 100644 --- a/skia/ext/skia_utils_mac.h +++ b/skia/ext/skia_utils_mac.h @@ -7,6 +7,7 @@ #pragma once #include <CoreGraphics/CGColor.h> +#include <vector> #include "third_party/skia/include/core/SkColor.h" @@ -23,8 +24,10 @@ typedef struct _NSSize NSSize; #ifdef __OBJC__ @class NSImage; +@class NSImageRep; #else class NSImage; +class NSImageRep; #endif namespace gfx { @@ -64,6 +67,9 @@ SkBitmap CGImageToSkBitmap(CGImageRef image); // Draws an NSImage with a given size into a SkBitmap. SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque); +// Draws an NSImageRep with a given size into a SkBitmap. +SkBitmap NSImageRepToSkBitmap(NSImageRep* image, NSSize size, bool is_opaque); + // Given an SkBitmap and a color space, return an autoreleased NSImage. NSImage* SkBitmapToNSImageWithColorSpace(const SkBitmap& icon, CGColorSpaceRef colorSpace); @@ -73,6 +79,10 @@ NSImage* SkBitmapToNSImageWithColorSpace(const SkBitmap& icon, // TODO(thakis): Remove this -- http://crbug.com/69432 NSImage* SkBitmapToNSImage(const SkBitmap& icon); +// Given a vector of SkBitmaps, return an NSImage with each bitmap added +// as a representation. +NSImage* SkBitmapsToNSImage(const std::vector<const SkBitmap*>& bitmaps); + // Returns |[NSImage imageNamed:@"NSApplicationIcon"]| as SkBitmap. SkBitmap AppplicationIconAtSize(int size); diff --git a/skia/ext/skia_utils_mac.mm b/skia/ext/skia_utils_mac.mm index c78121a..2ecb3f2 100644 --- a/skia/ext/skia_utils_mac.mm +++ b/skia/ext/skia_utils_mac.mm @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" +#include "base/memory/scoped_nsobject.h" #include "base/memory/scoped_ptr.h" #include "skia/ext/bitmap_platform_device_mac.h" #include "third_party/skia/include/utils/mac/SkCGUtils.h" @@ -116,15 +117,20 @@ SkBitmap CGImageToSkBitmap(CGImageRef image) { } SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque) { + return NSImageRepToSkBitmap([image bestRepresentationForDevice:nil], + size, is_opaque); +} + +SkBitmap NSImageRepToSkBitmap(NSImageRep* image, NSSize size, bool is_opaque) { SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, size.width, size.height); - if (bitmap.allocPixels() != true) + if (!bitmap.allocPixels()) return bitmap; // Return |bitmap| which should respond true to isNull(). bitmap.setIsOpaque(is_opaque); base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( - CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); + CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); void* data = bitmap.getPixels(); // Allocate a bitmap context with 4 components per pixel (BGRA). Apple @@ -145,21 +151,18 @@ SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque) { #undef HAS_ARGB_SHIFTS // Something went really wrong. Best guess is that the bitmap data is invalid. - DCHECK(context != NULL); + DCHECK(context); // Save the current graphics context so that we can restore it later. [NSGraphicsContext saveGraphicsState]; // Dummy context that we will draw into. NSGraphicsContext* context_cocoa = - [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]; + [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]; [NSGraphicsContext setCurrentContext:context_cocoa]; // This will stretch any images to |size| if it does not fit or is non-square. - [image drawInRect:NSMakeRect(0, 0, size.width, size.height) - fromRect:NSZeroRect - operation:NSCompositeCopy - fraction:1.0]; + [image drawInRect:NSMakeRect(0, 0, size.width, size.height)]; // Done drawing, restore context. [NSGraphicsContext restoreGraphicsState]; @@ -173,13 +176,12 @@ NSImage* SkBitmapToNSImageWithColorSpace(const SkBitmap& skiaBitmap, return nil; // First convert SkBitmap to CGImageRef. - CGImageRef cgimage = - SkCreateCGImageRefWithColorspace(skiaBitmap, colorSpace); + base::mac::ScopedCFTypeRef<CGImageRef> cgimage( + SkCreateCGImageRefWithColorspace(skiaBitmap, colorSpace)); // Now convert to NSImage. - NSBitmapImageRep* bitmap = [[[NSBitmapImageRep alloc] - initWithCGImage:cgimage] autorelease]; - CFRelease(cgimage); + scoped_nsobject<NSBitmapImageRep> bitmap( + [[NSBitmapImageRep alloc] initWithCGImage:cgimage]); NSImage* image = [[[NSImage alloc] init] autorelease]; [image addRepresentation:bitmap]; [image setSize:NSMakeSize(skiaBitmap.width(), skiaBitmap.height())]; @@ -192,6 +194,37 @@ NSImage* SkBitmapToNSImage(const SkBitmap& skiaBitmap) { return SkBitmapToNSImageWithColorSpace(skiaBitmap, colorSpace.get()); } +NSImage* SkBitmapsToNSImage(const std::vector<const SkBitmap*>& bitmaps) { + if (bitmaps.empty()) + return nil; + + base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( + CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); + NSImage* image = [[[NSImage alloc] init] autorelease]; + NSSize min_size = NSZeroSize; + + for (std::vector<const SkBitmap*>::const_iterator it = bitmaps.begin(); + it != bitmaps.end(); ++it) { + const SkBitmap& skiaBitmap = **it; + // First convert SkBitmap to CGImageRef. + base::mac::ScopedCFTypeRef<CGImageRef> cgimage( + SkCreateCGImageRefWithColorspace(skiaBitmap, color_space)); + + // Now convert to NSImage. + scoped_nsobject<NSBitmapImageRep> bitmap( + [[NSBitmapImageRep alloc] initWithCGImage:cgimage]); + [image addRepresentation:bitmap]; + + if (min_size.width == 0 || min_size.width > skiaBitmap.width()) { + min_size.width = skiaBitmap.width(); + min_size.height = skiaBitmap.height(); + } + } + + [image setSize:min_size]; + return image; +} + SkBitmap AppplicationIconAtSize(int size) { NSImage* image = [NSImage imageNamed:@"NSApplicationIcon"]; return NSImageToSkBitmap(image, NSMakeSize(size, size), /* is_opaque=*/true); diff --git a/skia/ext/skia_utils_mac_unittest.mm b/skia/ext/skia_utils_mac_unittest.mm index 1726c4a..c86be98 100644 --- a/skia/ext/skia_utils_mac_unittest.mm +++ b/skia/ext/skia_utils_mac_unittest.mm @@ -9,39 +9,60 @@ namespace { class SkiaUtilsMacTest : public testing::Test { public: + // Creates a red or blue bitmap. + SkBitmap CreateSkBitmap(int width, int height, bool isred, bool tfbit); + + // Creates a red or blue image. + NSImage* CreateNSImage(int width, int height, bool isred); + + // Checks that the given bitmap rep is actually red or blue. + void TestImageRep(NSBitmapImageRep* imageRep, bool isred); + + // Checks that the given bitmap is actually red or blue. + void TestSkBitmap(const SkBitmap& bitmap, bool isred); + // If not red, is blue. // If not tfbit (twenty-four-bit), is 444. void ShapeHelper(int width, int height, bool isred, bool tfbit); }; -void SkiaUtilsMacTest::ShapeHelper(int width, int height, - bool isred, bool tfbit) { - SkBitmap thing; +SkBitmap SkiaUtilsMacTest::CreateSkBitmap(int width, int height, + bool isred, bool tfbit) { + SkBitmap bitmap; if (tfbit) - thing.setConfig(SkBitmap::kARGB_8888_Config, width, height); + bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); else - thing.setConfig(SkBitmap::kARGB_4444_Config, width, height); - thing.allocPixels(); + bitmap.setConfig(SkBitmap::kARGB_4444_Config, width, height); + bitmap.allocPixels(); if (isred) - thing.eraseRGB(0xff, 0, 0); + bitmap.eraseRGB(0xff, 0, 0); else - thing.eraseRGB(0, 0, 0xff); + bitmap.eraseRGB(0, 0, 0xff); - // Confirm size - NSImage* image = gfx::SkBitmapToNSImage(thing); - EXPECT_DOUBLE_EQ([image size].width, (double)width); - EXPECT_DOUBLE_EQ([image size].height, (double)height); + return bitmap; +} - // Get the color of a pixel and make sure it looks fine +NSImage* SkiaUtilsMacTest::CreateNSImage(int width, int height, bool isred) { + NSImage* image = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] + autorelease]; [image lockFocus]; + if (isred) + [[NSColor colorWithDeviceRed:1.0 green:0.0 blue:0.0 alpha:1.0] set]; + else + [[NSColor colorWithDeviceRed:0.0 green:0.0 blue:1.0 alpha:1.0] set]; + NSRectFill(NSMakeRect(0, 0, width, height)); + [image unlockFocus]; + return image; +} - int x = width > 17 ? 17 : 0; - int y = height > 17 ? 17 : 0; - NSColor* color = NSReadPixel(NSMakePoint(x, y)); +void SkiaUtilsMacTest::TestImageRep(NSBitmapImageRep* imageRep, bool isred) { + // Get the color of a pixel and make sure it looks fine + int x = [imageRep size].width > 17 ? 17 : 0; + int y = [imageRep size].height > 17 ? 17 : 0; + NSColor* color = [imageRep colorAtX:x y:y]; CGFloat red = 0, green = 0, blue = 0, alpha = 0; - [image unlockFocus]; // SkBitmapToNSImage returns a bitmap in the calibrated color space (sRGB), // while NSReadPixel returns a color in the device color space. Convert back @@ -52,14 +73,47 @@ void SkiaUtilsMacTest::ShapeHelper(int width, int height, // Be tolerant of floating point rounding and lossy color space conversions. if (isred) { - EXPECT_GT(red, 0.95); - EXPECT_LT(blue, 0.05); + EXPECT_NEAR(red, 1.0, 0.025); + EXPECT_NEAR(blue, 0.0, 0.025); + } else { + EXPECT_NEAR(red, 0.0, 0.025); + EXPECT_NEAR(blue, 1.0, 0.025); + } + EXPECT_NEAR(green, 0.0, 0.025); + EXPECT_NEAR(alpha, 1.0, 0.025); +} + +void SkiaUtilsMacTest::TestSkBitmap(const SkBitmap& bitmap, bool isred) { + int x = bitmap.width() > 17 ? 17 : 0; + int y = bitmap.height() > 17 ? 17 : 0; + SkColor color = bitmap.getColor(x, y); + + // Due to colorspace issues the colors may not match exactly. + // TODO(sail): Need to fix this, http://crbug.com/79946 + if (isred) { + EXPECT_NEAR(255u, SkColorGetR(color), 20); + EXPECT_NEAR(0u, SkColorGetB(color), 20); } else { - EXPECT_LT(red, 0.05); - EXPECT_GT(blue, 0.95); + EXPECT_NEAR(0u, SkColorGetR(color), 20); + EXPECT_NEAR(255u, SkColorGetB(color), 20); } - EXPECT_LT(green, 0.05); - EXPECT_GT(alpha, 0.95); + EXPECT_NEAR(0u, SkColorGetG(color), 20); + EXPECT_NEAR(255u, SkColorGetA(color), 20); +} + +void SkiaUtilsMacTest::ShapeHelper(int width, int height, + bool isred, bool tfbit) { + SkBitmap thing(CreateSkBitmap(width, height, isred, tfbit)); + + // Confirm size + NSImage* image = gfx::SkBitmapToNSImage(thing); + EXPECT_DOUBLE_EQ([image size].width, (double)width); + EXPECT_DOUBLE_EQ([image size].height, (double)height); + + EXPECT_TRUE([[image representations] count] == 1); + EXPECT_TRUE([[[image representations] lastObject] + isKindOfClass:[NSBitmapImageRep class]]); + TestImageRep([[image representations] lastObject], isred); } TEST_F(SkiaUtilsMacTest, BitmapToNSImage_RedSquare64x64) { @@ -74,4 +128,49 @@ TEST_F(SkiaUtilsMacTest, BitmapToNSImage_BlueRectangle444) { ShapeHelper(200, 200, false, false); } +TEST_F(SkiaUtilsMacTest, MultipleBitmapsToNSImage) { + int redWidth = 10; + int redHeight = 15; + int blueWidth = 20; + int blueHeight = 30; + + SkBitmap redBitmap(CreateSkBitmap(redWidth, redHeight, true, true)); + SkBitmap blueBitmap(CreateSkBitmap(blueWidth, blueHeight, false, true)); + std::vector<const SkBitmap*> bitmaps; + bitmaps.push_back(&redBitmap); + bitmaps.push_back(&blueBitmap); + + NSImage* image = gfx::SkBitmapsToNSImage(bitmaps); + + // Image size should be the same as the smallest bitmap. + EXPECT_DOUBLE_EQ(redWidth, [image size].width); + EXPECT_DOUBLE_EQ(redHeight, [image size].height); + + EXPECT_EQ(2u, [[image representations] count]); + + for (NSBitmapImageRep* imageRep in [image representations]) { + NSBitmapImageRep* imageRep = [[image representations] objectAtIndex:0]; + bool isred = [imageRep size].width == redWidth; + if (isred) { + EXPECT_DOUBLE_EQ(redHeight, [imageRep size].height); + } else { + EXPECT_DOUBLE_EQ(blueWidth, [imageRep size].width); + EXPECT_DOUBLE_EQ(blueHeight, [imageRep size].height); + } + TestImageRep(imageRep, isred); + } +} + +TEST_F(SkiaUtilsMacTest, NSImageRepToSkBitmap) { + int width = 10; + int height = 15; + bool isred = true; + + NSImage* image = CreateNSImage(width, height, isred); + EXPECT_EQ(1u, [[image representations] count]); + NSBitmapImageRep* imageRep = [[image representations] lastObject]; + SkBitmap bitmap(gfx::NSImageRepToSkBitmap(imageRep, [image size], false)); + TestSkBitmap(bitmap, isred); +} + } // namespace diff --git a/tools/grit/grit/format/resource_map.py b/tools/grit/grit/format/resource_map.py index 5ae135b..4527af8 100644 --- a/tools/grit/grit/format/resource_map.py +++ b/tools/grit/grit/format/resource_map.py @@ -49,10 +49,14 @@ class HeaderTopLevel(interface.ItemFormatter): #include <stddef.h> +#ifndef GRIT_RESOURCE_MAP_STRUCT_ +#define GRIT_RESOURCE_MAP_STRUCT_ struct GritResourceMap { const char* const name; int value; }; +#endif // GRIT_RESOURCE_MAP_STRUCT_ + extern const GritResourceMap %(map_name)s[]; extern const size_t %(map_name)sSize; ''' % { 'year': util.GetCurrentYear(), diff --git a/tools/grit/resource_ids b/tools/grit/resource_ids index b89b95de..c871600 100644 --- a/tools/grit/resource_ids +++ b/tools/grit/resource_ids @@ -130,5 +130,12 @@ # This file is generated during the build. "<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd": { "includes": [20500], - } + }, + # All standard and large theme resources should have the same IDs. + "chrome/app/theme/theme_resources_standard.grd": { + "includes": [21000], + }, + "chrome/app/theme/theme_resources_large.grd": { + "includes": [21000], + }, } diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 1b6fd11..306a61e 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -119,6 +119,11 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) { scoped_ptr<SkBitmap> bitmap(LoadBitmap(resources_data_, resource_id)); if (bitmap.get()) { + // Check if there's a large version of the image as well. + scoped_ptr<SkBitmap> large_bitmap; + if (large_icon_resources_data_) + large_bitmap.reset(LoadBitmap(large_icon_resources_data_, resource_id)); + // The load was successful, so cache the image. base::AutoLock lock_scope(*lock_); @@ -126,7 +131,11 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) { if (images_.count(resource_id)) return *images_[resource_id]; - gfx::Image* image = new gfx::Image(bitmap.release()); + std::vector<const SkBitmap*> bitmaps; + bitmaps.push_back(bitmap.release()); + if (large_bitmap.get()) + bitmaps.push_back(large_bitmap.release()); + gfx::Image* image = new gfx::Image(bitmaps); images_[resource_id] = image; return *image; } @@ -190,6 +199,7 @@ void ResourceBundle::ReloadFonts() { ResourceBundle::ResourceBundle() : lock_(new base::Lock), resources_data_(NULL), + large_icon_resources_data_(NULL), locale_resources_data_(NULL) { } diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h index 2598662..cdd9383 100644 --- a/ui/base/resource/resource_bundle.h +++ b/ui/base/resource/resource_bundle.h @@ -235,6 +235,8 @@ class ResourceBundle { // Returns the full pathname of the main resources file to load. May return // an empty string if no main resources data files are found. static FilePath GetResourcesFilePath(); + + static FilePath GetLargeIconResourcesFilePath(); #endif // Returns the full pathname of the locale file to load. May return an empty @@ -263,6 +265,7 @@ class ResourceBundle { // Handles for data sources. DataHandle resources_data_; + DataHandle large_icon_resources_data_; DataHandle locale_resources_data_; // References to extra data packs loaded via AddDataPackToSharedInstance. diff --git a/ui/base/resource/resource_bundle_linux.cc b/ui/base/resource/resource_bundle_linux.cc index 437f725..5806fb0 100644 --- a/ui/base/resource/resource_bundle_linux.cc +++ b/ui/base/resource/resource_bundle_linux.cc @@ -66,6 +66,12 @@ FilePath ResourceBundle::GetResourcesFilePath() { } // static +FilePath ResourceBundle::GetLargeIconResourcesFilePath() { + // Not supported. + return FilePath(); +} + +// static FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { FilePath locale_file_path; PathService::Get(ui::DIR_LOCALES, &locale_file_path); diff --git a/ui/base/resource/resource_bundle_mac.mm b/ui/base/resource/resource_bundle_mac.mm index 1a238a7..0508177 100644 --- a/ui/base/resource/resource_bundle_mac.mm +++ b/ui/base/resource/resource_bundle_mac.mm @@ -46,6 +46,11 @@ FilePath ResourceBundle::GetResourcesFilePath() { } // static +FilePath ResourceBundle::GetLargeIconResourcesFilePath() { + return GetResourcesPakFilePath(@"theme_resources_large", nil); +} + +// static FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { NSString* mac_locale = base::SysUTF8ToNSString(app_locale); @@ -89,6 +94,21 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { // Cache the converted image. if (ns_image.get()) { + // Load a high resolution version of the icon if available. + if (large_icon_resources_data_) { + scoped_refptr<RefCountedStaticMemory> large_data( + LoadResourceBytes(large_icon_resources_data_, resource_id)); + if (large_data.get()) { + scoped_nsobject<NSData> ns_large_data( + [[NSData alloc] initWithBytes:large_data->front() + length:large_data->size()]); + NSImageRep* image_rep = + [NSBitmapImageRep imageRepWithData:ns_large_data]; + if (image_rep) + [ns_image addRepresentation:image_rep]; + } + } + base::AutoLock lock(*lock_); // Another thread raced the load and has already cached the image. diff --git a/ui/base/resource/resource_bundle_posix.cc b/ui/base/resource/resource_bundle_posix.cc index 97747e0..d2fe55b 100644 --- a/ui/base/resource/resource_bundle_posix.cc +++ b/ui/base/resource/resource_bundle_posix.cc @@ -98,6 +98,14 @@ void ResourceBundle::LoadCommonResources() { CHECK(!resources_file_path.empty()) << "chrome.pak not found"; resources_data_ = LoadResourcesDataPak(resources_file_path); CHECK(resources_data_) << "failed to load chrome.pak"; + + FilePath large_icon_resources_file_path = GetLargeIconResourcesFilePath(); + if (!large_icon_resources_file_path.empty()) { + large_icon_resources_data_ = + LoadResourcesDataPak(large_icon_resources_file_path); + CHECK(large_icon_resources_data_) << + "failed to load theme_resources_large.pak"; + } } std::string ResourceBundle::LoadLocaleResources( diff --git a/ui/gfx/image.cc b/ui/gfx/image.cc index b42e215..389935dc8 100644 --- a/ui/gfx/image.cc +++ b/ui/gfx/image.cc @@ -7,6 +7,7 @@ #include <algorithm> #include "base/logging.h" +#include "base/stl_util-inl.h" #include "third_party/skia/include/core/SkBitmap.h" #if defined(OS_LINUX) @@ -26,7 +27,7 @@ namespace internal { #if defined(OS_MACOSX) // This is a wrapper around gfx::NSImageToSkBitmap() because this cross-platform // file cannot include the [square brackets] of ObjC. -const SkBitmap* NSImageToSkBitmap(NSImage* image); +bool NSImageToSkBitmaps(NSImage* image, std::vector<const SkBitmap*>& bitmaps); #endif #if defined(OS_LINUX) @@ -84,20 +85,27 @@ class ImageRep { class SkBitmapRep : public ImageRep { public: explicit SkBitmapRep(const SkBitmap* bitmap) - : ImageRep(Image::kSkBitmapRep), - bitmap_(bitmap) { + : ImageRep(Image::kSkBitmapRep) { CHECK(bitmap); + bitmaps_.push_back(bitmap); + } + + explicit SkBitmapRep(const std::vector<const SkBitmap*>& bitmaps) + : ImageRep(Image::kSkBitmapRep), + bitmaps_(bitmaps) { + CHECK(!bitmaps_.empty()); } virtual ~SkBitmapRep() { - delete bitmap_; - bitmap_ = NULL; + STLDeleteElements(&bitmaps_); } - const SkBitmap* bitmap() const { return bitmap_; } + const SkBitmap* bitmap() const { return bitmaps_[0]; } + + const std::vector<const SkBitmap*>& bitmaps() const { return bitmaps_; } private: - const SkBitmap* bitmap_; + std::vector<const SkBitmap*> bitmaps_; DISALLOW_COPY_AND_ASSIGN(SkBitmapRep); }; @@ -158,6 +166,12 @@ Image::Image(const SkBitmap* bitmap) AddRepresentation(rep); } +Image::Image(const std::vector<const SkBitmap*>& bitmaps) + : default_representation_(Image::kSkBitmapRep) { + internal::SkBitmapRep* rep = new internal::SkBitmapRep(bitmaps); + AddRepresentation(rep); +} + #if defined(OS_LINUX) Image::Image(GdkPixbuf* pixbuf) : default_representation_(Image::kGdkPixbufRep) { @@ -246,8 +260,9 @@ internal::ImageRep* Image::GetRepresentation(RepresentationType rep_type) { #elif defined(OS_MACOSX) if (default_representation_ == Image::kNSImageRep) { internal::NSImageRep* nsimage_rep = default_rep->AsNSImageRep(); - rep = new internal::SkBitmapRep( - internal::NSImageToSkBitmap(nsimage_rep->image())); + std::vector<const SkBitmap*> bitmaps; + CHECK(internal::NSImageToSkBitmaps(nsimage_rep->image(), bitmaps)); + rep = new internal::SkBitmapRep(bitmaps); } #endif CHECK(rep); @@ -266,7 +281,7 @@ internal::ImageRep* Image::GetRepresentation(RepresentationType rep_type) { } #elif defined(OS_MACOSX) if (rep_type == Image::kNSImageRep) { - NSImage* image = gfx::SkBitmapToNSImage(*(skia_rep->bitmap())); + NSImage* image = gfx::SkBitmapsToNSImage(skia_rep->bitmaps()); base::mac::NSObjectRetain(image); native_rep = new internal::NSImageRep(image); } @@ -284,4 +299,14 @@ void Image::AddRepresentation(internal::ImageRep* rep) { representations_.insert(std::make_pair(rep->type(), rep)); } +size_t Image::GetNumberOfSkBitmaps() { + return GetRepresentation(Image::kSkBitmapRep)->AsSkBitmapRep()-> + bitmaps().size(); +} + +const SkBitmap* Image::GetSkBitmapAtIndex(size_t index) { + return GetRepresentation(Image::kSkBitmapRep)->AsSkBitmapRep()-> + bitmaps()[index]; +} + } // namespace gfx diff --git a/ui/gfx/image.h b/ui/gfx/image.h index fddf4da..69117ff 100644 --- a/ui/gfx/image.h +++ b/ui/gfx/image.h @@ -15,6 +15,7 @@ #pragma once #include <map> +#include <vector> #include "base/basictypes.h" #include "base/gtest_prod_util.h" @@ -25,6 +26,7 @@ class SkBitmap; namespace { class ImageTest; +class ImageMacTest; } namespace gfx { @@ -44,11 +46,17 @@ class Image { // Creates a new image with the default representation. The object will take // ownership of the image. explicit Image(const SkBitmap* bitmap); + // To create an Image that supports multiple resolutions pass a vector + // of bitmaps, one for each resolution. + explicit Image(const std::vector<const SkBitmap*>& bitmaps); + #if defined(OS_LINUX) // Does not increase |pixbuf|'s reference count; expects to take ownership. explicit Image(GdkPixbuf* pixbuf); #elif defined(OS_MACOSX) // Does not retain |image|; expects to take ownership. + // A single NSImage object can contain multiple bitmaps so there's no reason + // to pass a vector of these. explicit Image(NSImage* image); #endif @@ -64,6 +72,16 @@ class Image { operator NSImage*(); #endif + // Gets the number of bitmaps in this image. This may cause a conversion + // to a bitmap representation. Note, this function and GetSkBitmapAtIndex() + // are primarily meant to be used by the theme provider. + size_t GetNumberOfSkBitmaps(); + + // Gets the bitmap at the given index. This may cause a conversion + // to a bitmap representation. Note, the internal ordering of bitmaps is not + // guaranteed. + const SkBitmap* GetSkBitmapAtIndex(size_t index); + // Inspects the representations map to see if the given type exists. bool HasRepresentation(RepresentationType type); @@ -92,6 +110,7 @@ class Image { RepresentationMap representations_; friend class ::ImageTest; + friend class ::ImageMacTest; DISALLOW_COPY_AND_ASSIGN(Image); }; diff --git a/ui/gfx/image_mac.mm b/ui/gfx/image_mac.mm index b3dc977..544c214 100644 --- a/ui/gfx/image_mac.mm +++ b/ui/gfx/image_mac.mm @@ -4,14 +4,22 @@ #import <AppKit/AppKit.h> +#include "base/memory/scoped_ptr.h" #include "skia/ext/skia_utils_mac.h" #include "third_party/skia/include/core/SkBitmap.h" namespace gfx { namespace internal { -const SkBitmap* NSImageToSkBitmap(NSImage* image) { - return new SkBitmap(::gfx::NSImageToSkBitmap(image, [image size], false)); +bool NSImageToSkBitmaps(NSImage* image, std::vector<const SkBitmap*>& bitmaps) { + for (NSImageRep* imageRep in [image representations]) { + scoped_ptr<SkBitmap> bitmap(new SkBitmap( + gfx::NSImageRepToSkBitmap(imageRep, [imageRep size], false))); + if (bitmap->isNull()) + return false; + bitmaps.push_back(bitmap.release()); + } + return true; } } // namespace internal diff --git a/ui/gfx/image_mac_unittest.mm b/ui/gfx/image_mac_unittest.mm new file mode 100644 index 0000000..7d19e73 --- /dev/null +++ b/ui/gfx/image_mac_unittest.mm @@ -0,0 +1,114 @@ +// 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. + +#include <Cocoa/Cocoa.h> + +#include "base/logging.h" +#include "base/memory/scoped_nsobject.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkBitmap.h" +#include "ui/gfx/image.h" +#include "ui/gfx/image_unittest_util.h" + +namespace { + +class ImageMacTest : public testing::Test { + public: + size_t GetRepCount(const gfx::Image& image) { + return image.representations_.size(); + } + + void CreateBitmapImageRep(int width, int height, NSImageRep** image_rep) { + scoped_nsobject<NSImage> image([[NSImage alloc] + initWithSize:NSMakeSize(width, height)]); + [image lockFocus]; + [[NSColor redColor] set]; + NSRectFill(NSMakeRect(0, 0, width, height)); + [image unlockFocus]; + EXPECT_TRUE([[[image representations] lastObject] + isKindOfClass:[NSImageRep class]]); + *image_rep = [[image representations] lastObject]; + } +}; + +namespace gt = gfx::test; + +TEST_F(ImageMacTest, MultiResolutionNSImageToSkBitmap) { + const int width1 = 10; + const int height1 = 12; + const int width2 = 20; + const int height2 = 24; + + NSImageRep* image_rep_1; + CreateBitmapImageRep(width1, height1, &image_rep_1); + NSImageRep* image_rep_2; + CreateBitmapImageRep(width2, height2, &image_rep_2); + scoped_nsobject<NSImage> ns_image([[NSImage alloc] + initWithSize:NSMakeSize(width1, height1)]); + [ns_image addRepresentation:image_rep_1]; + [ns_image addRepresentation:image_rep_2]; + + gfx::Image image(ns_image.release()); + + EXPECT_EQ(1u, GetRepCount(image)); + EXPECT_EQ(2u, image.GetNumberOfSkBitmaps()); + + const SkBitmap* bitmap1 = image.GetSkBitmapAtIndex(0); + EXPECT_TRUE(bitmap1); + const SkBitmap* bitmap2 = image.GetSkBitmapAtIndex(1); + EXPECT_TRUE(bitmap2); + + if (bitmap1->width() == width1) { + EXPECT_EQ(bitmap1->height(), height1); + EXPECT_EQ(bitmap2->width(), width2); + EXPECT_EQ(bitmap2->height(), height2); + } else { + EXPECT_EQ(bitmap1->width(), width2); + EXPECT_EQ(bitmap1->height(), height2); + EXPECT_EQ(bitmap2->width(), width1); + EXPECT_EQ(bitmap2->height(), height1); + } + + // GetNumberOfSkBitmaps and GetSkBitmapAtIndex should create a second + // representation. + EXPECT_EQ(2u, GetRepCount(image)); +} + +TEST_F(ImageMacTest, MultiResolutionSkBitmapToNSImage) { + const int width1 = 10; + const int height1 = 12; + const int width2 = 20; + const int height2 = 24; + + std::vector<const SkBitmap*> bitmaps; + bitmaps.push_back(gt::CreateBitmap(width1, height1)); + bitmaps.push_back(gt::CreateBitmap(width2, height2)); + gfx::Image image(bitmaps); + + EXPECT_EQ(1u, GetRepCount(image)); + EXPECT_EQ(2u, image.GetNumberOfSkBitmaps()); + + NSImage* ns_image = image; + EXPECT_TRUE(ns_image); + + EXPECT_EQ(2u, [[image representations] count]); + NSImageRep* image_rep_1 = [[image representations] objectAtIndex:0]; + NSImageRep* image_rep_2 = [[image representations] objectAtIndex:1]; + + if ([image_rep_1 size].width == width1) { + EXPECT_EQ([image_rep_1 size].height, height1); + EXPECT_EQ([image_rep_2 size].width, width2); + EXPECT_EQ([image_rep_2 size].height, height2); + } else { + EXPECT_EQ([image_rep_1 size].width, width2); + EXPECT_EQ([image_rep_1 size].height, height2); + EXPECT_EQ([image_rep_2 size].width, width1); + EXPECT_EQ([image_rep_2 size].height, height1); + } + + // Cast to NSImage* should create a second representation. + EXPECT_EQ(2u, GetRepCount(image)); +} + +} // namespace diff --git a/ui/gfx/image_unittest.cc b/ui/gfx/image_unittest.cc index 6f41bfe..f02a2fa 100644 --- a/ui/gfx/image_unittest.cc +++ b/ui/gfx/image_unittest.cc @@ -6,7 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image.h" -#include "ui/gfx/image_unittest.h" +#include "ui/gfx/image_unittest_util.h" #if defined(OS_LINUX) #include <gtk/gtk.h> @@ -34,7 +34,7 @@ class ImageTest : public testing::Test { namespace gt = gfx::test; TEST_F(ImageTest, SkiaToSkia) { - gfx::Image image(gt::CreateBitmap()); + gfx::Image image(gt::CreateBitmap(25, 25)); const SkBitmap* bitmap = static_cast<const SkBitmap*>(image); EXPECT_TRUE(bitmap); EXPECT_FALSE(bitmap->isNull()); @@ -52,7 +52,7 @@ TEST_F(ImageTest, SkiaToSkia) { } TEST_F(ImageTest, SkiaToSkiaRef) { - gfx::Image image(gt::CreateBitmap()); + gfx::Image image(gt::CreateBitmap(25, 25)); const SkBitmap& bitmap = static_cast<const SkBitmap&>(image); EXPECT_FALSE(bitmap.isNull()); @@ -68,7 +68,7 @@ TEST_F(ImageTest, SkiaToSkiaRef) { } TEST_F(ImageTest, SkiaToPlatform) { - gfx::Image image(gt::CreateBitmap()); + gfx::Image image(gt::CreateBitmap(25, 25)); const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U; EXPECT_TRUE(image.HasRepresentation(gfx::Image::kSkBitmapRep)); @@ -131,7 +131,7 @@ TEST_F(ImageTest, CheckSkiaColor) { TEST_F(ImageTest, SwapRepresentations) { const size_t kRepCount = kUsesSkiaNatively ? 1U : 2U; - gfx::Image image1(gt::CreateBitmap()); + gfx::Image image1(gt::CreateBitmap(25, 25)); const SkBitmap* bitmap1 = image1; EXPECT_EQ(1U, GetRepCount(image1)); @@ -149,6 +149,41 @@ TEST_F(ImageTest, SwapRepresentations) { EXPECT_EQ(1U, GetRepCount(image2)); } +TEST_F(ImageTest, MultiResolutionSkBitmap) { + const int width1 = 10; + const int height1 = 12; + const int width2 = 20; + const int height2 = 24; + + std::vector<const SkBitmap*> bitmaps; + bitmaps.push_back(gt::CreateBitmap(width1, height1)); + bitmaps.push_back(gt::CreateBitmap(width2, height2)); + gfx::Image image(bitmaps); + + EXPECT_EQ(1u, GetRepCount(image)); + EXPECT_EQ(2u, image.GetNumberOfSkBitmaps()); + + const SkBitmap* bitmap1 = image.GetSkBitmapAtIndex(0); + EXPECT_TRUE(bitmap1); + const SkBitmap* bitmap2 = image.GetSkBitmapAtIndex(1); + EXPECT_TRUE(bitmap2); + + if (bitmap1->width() == width1) { + EXPECT_EQ(bitmap1->height(), height1); + EXPECT_EQ(bitmap2->width(), width2); + EXPECT_EQ(bitmap2->height(), height2); + } else { + EXPECT_EQ(bitmap1->width(), width2); + EXPECT_EQ(bitmap1->height(), height2); + EXPECT_EQ(bitmap2->width(), width1); + EXPECT_EQ(bitmap2->height(), height1); + } + + // Sanity check. + EXPECT_EQ(1u, GetRepCount(image)); + EXPECT_EQ(2u, image.GetNumberOfSkBitmaps()); +} + // Integration tests with UI toolkit frameworks require linking against the // Views library and cannot be here (gfx_unittests doesn't include it). They // instead live in /chrome/browser/ui/tests/ui_gfx_image_unittest.cc. diff --git a/ui/gfx/image_unittest.h b/ui/gfx/image_unittest_util.cc index 09abfce..b996a86 100644 --- a/ui/gfx/image_unittest.h +++ b/ui/gfx/image_unittest_util.cc @@ -5,10 +5,8 @@ // Because the unit tests for gfx::Image are spread across multiple // implementation files, this header contains the reusable components. -#ifndef UI_GFX_IMAGE_UNITTEST_H_ -#define UI_GFX_IMAGE_UNITTEST_H_ - #include "base/memory/scoped_ptr.h" +#include "ui/gfx/image_unittest_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -22,24 +20,16 @@ namespace gfx { namespace test { -#if defined(OS_MACOSX) -typedef NSImage* PlatformImage; -#elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) -typedef GdkPixbuf* PlatformImage; -#else -typedef const SkBitmap* PlatformImage; -#endif - -SkBitmap* CreateBitmap() { +SkBitmap* CreateBitmap(int width, int height) { SkBitmap* bitmap = new SkBitmap(); - bitmap->setConfig(SkBitmap::kARGB_8888_Config, 25, 25); + bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); bitmap->allocPixels(); bitmap->eraseRGB(255, 0, 0); return bitmap; } PlatformImage CreatePlatformImage() { - scoped_ptr<SkBitmap> bitmap(CreateBitmap()); + scoped_ptr<SkBitmap> bitmap(CreateBitmap(25, 25)); #if defined(OS_MACOSX) NSImage* image = gfx::SkBitmapToNSImage(*(bitmap.get())); base::mac::NSObjectRetain(image); @@ -63,5 +53,3 @@ gfx::Image::RepresentationType GetPlatformRepresentationType() { } // namespace test } // namespace gfx - -#endif // UI_GFX_IMAGE_UNITTEST_H_ diff --git a/ui/gfx/image_unittest_util.h b/ui/gfx/image_unittest_util.h new file mode 100644 index 0000000..f087f90 --- /dev/null +++ b/ui/gfx/image_unittest_util.h @@ -0,0 +1,33 @@ +// 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. + +// Because the unit tests for gfx::Image are spread across multiple +// implementation files, this header contains the reusable components. + +#ifndef UI_GFX_IMAGE_UNITTEST_UTIL_H_ +#define UI_GFX_IMAGE_UNITTEST_UTIL_H_ + +#include "ui/gfx/image.h" + +namespace gfx { +namespace test { + +#if defined(OS_MACOSX) +typedef NSImage* PlatformImage; +#elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +typedef GdkPixbuf* PlatformImage; +#else +typedef const SkBitmap* PlatformImage; +#endif + +SkBitmap* CreateBitmap(int width, int height); + +PlatformImage CreatePlatformImage(); + +gfx::Image::RepresentationType GetPlatformRepresentationType(); + +} // namespace test +} // namespace gfx + +#endif // UI_GFX_IMAGE_UNITTEST_UTIL_H_ diff --git a/ui/ui_unittests.gypi b/ui/ui_unittests.gypi index 2a767a4..2867afb 100644 --- a/ui/ui_unittests.gypi +++ b/ui/ui_unittests.gypi @@ -32,8 +32,10 @@ 'gfx/codec/png_codec_unittest.cc', 'gfx/color_utils_unittest.cc', 'gfx/font_unittest.cc', + 'gfx/image_mac_unittest.mm', 'gfx/image_unittest.cc', - 'gfx/image_unittest.h', + 'gfx/image_unittest_util.h', + 'gfx/image_unittest_util.cc', 'gfx/insets_unittest.cc', 'gfx/rect_unittest.cc', 'gfx/run_all_unittests.cc', |