diff options
author | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 22:50:02 +0000 |
---|---|---|
committer | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 22:50:02 +0000 |
commit | d1fc6a0dc5253f1bcc5ac1158db99b8f0c6cd3dd (patch) | |
tree | 4c0a1cec1b91f44693a3f82be8aa3e31747265a3 /chrome | |
parent | bc2353c8a60e502db9068bf369fba7998928852a (diff) | |
download | chromium_src-d1fc6a0dc5253f1bcc5ac1158db99b8f0c6cd3dd.zip chromium_src-d1fc6a0dc5253f1bcc5ac1158db99b8f0c6cd3dd.tar.gz chromium_src-d1fc6a0dc5253f1bcc5ac1158db99b8f0c6cd3dd.tar.bz2 |
Changed TouchTab and TouchTabStrip to derive from existing code since the look and feel of the new spec is significantly closer to the desktop one.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7799016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99262 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
51 files changed, 148 insertions, 832 deletions
diff --git a/chrome/app/theme/large_close_bar.png b/chrome/app/theme/large_close_bar.png Binary files differindex ba7c686..324d1b1 100644 --- a/chrome/app/theme/large_close_bar.png +++ b/chrome/app/theme/large_close_bar.png diff --git a/chrome/app/theme/large_close_bar_h.png b/chrome/app/theme/large_close_bar_h.png Binary files differindex 08fe621..38b605c 100644 --- a/chrome/app/theme/large_close_bar_h.png +++ b/chrome/app/theme/large_close_bar_h.png diff --git a/chrome/app/theme/large_close_bar_mask.png b/chrome/app/theme/large_close_bar_mask.png Binary files differindex 78fe533..9e54b9c 100644 --- a/chrome/app/theme/large_close_bar_mask.png +++ b/chrome/app/theme/large_close_bar_mask.png diff --git a/chrome/app/theme/large_close_bar_p.png b/chrome/app/theme/large_close_bar_p.png Binary files differindex fffb12f..134db7f 100644 --- a/chrome/app/theme/large_close_bar_p.png +++ b/chrome/app/theme/large_close_bar_p.png diff --git a/chrome/app/theme/large_content_top_center.png b/chrome/app/theme/large_content_top_center.png Binary files differindex b60f005..8dca54f 100644 --- a/chrome/app/theme/large_content_top_center.png +++ b/chrome/app/theme/large_content_top_center.png diff --git a/chrome/app/theme/large_content_top_left_corner.png b/chrome/app/theme/large_content_top_left_corner.png Binary files differindex d74f75c..d9a1423 100644 --- a/chrome/app/theme/large_content_top_left_corner.png +++ b/chrome/app/theme/large_content_top_left_corner.png diff --git a/chrome/app/theme/large_content_top_left_corner_mask.png b/chrome/app/theme/large_content_top_left_corner_mask.png Binary files differindex 63220c2..2d93f6b 100644 --- a/chrome/app/theme/large_content_top_left_corner_mask.png +++ b/chrome/app/theme/large_content_top_left_corner_mask.png diff --git a/chrome/app/theme/large_content_top_right_corner.png b/chrome/app/theme/large_content_top_right_corner.png Binary files differindex 0e3f2e0..c53bbc5 100644 --- a/chrome/app/theme/large_content_top_right_corner.png +++ b/chrome/app/theme/large_content_top_right_corner.png diff --git a/chrome/app/theme/large_content_top_right_corner_mask.png b/chrome/app/theme/large_content_top_right_corner_mask.png Binary files differindex ec44e99..a363f7d 100644 --- a/chrome/app/theme/large_content_top_right_corner_mask.png +++ b/chrome/app/theme/large_content_top_right_corner_mask.png diff --git a/chrome/app/theme/large_newtab.png b/chrome/app/theme/large_newtab.png Binary files differindex 73940fc..970b6f6 100644 --- a/chrome/app/theme/large_newtab.png +++ b/chrome/app/theme/large_newtab.png diff --git a/chrome/app/theme/large_newtab_button_mask.png b/chrome/app/theme/large_newtab_button_mask.png Binary files differindex 8efeb92..2aa7294 100644 --- a/chrome/app/theme/large_newtab_button_mask.png +++ b/chrome/app/theme/large_newtab_button_mask.png diff --git a/chrome/app/theme/large_newtab_h.png b/chrome/app/theme/large_newtab_h.png Binary files differindex a768fde..970b6f6 100644 --- a/chrome/app/theme/large_newtab_h.png +++ b/chrome/app/theme/large_newtab_h.png diff --git a/chrome/app/theme/large_newtab_p.png b/chrome/app/theme/large_newtab_p.png Binary files differindex 1b64c7c..88323f2 100644 --- a/chrome/app/theme/large_newtab_p.png +++ b/chrome/app/theme/large_newtab_p.png diff --git a/chrome/app/theme/large_omnibox.png b/chrome/app/theme/large_omnibox.png Binary files differdeleted file mode 100644 index e54a371..0000000 --- a/chrome/app/theme/large_omnibox.png +++ /dev/null diff --git a/chrome/app/theme/large_omnibox_c.png b/chrome/app/theme/large_omnibox_c.png Binary files differindex 05012da..5af3bd5 100644 --- a/chrome/app/theme/large_omnibox_c.png +++ b/chrome/app/theme/large_omnibox_c.png diff --git a/chrome/app/theme/large_omnibox_l.png b/chrome/app/theme/large_omnibox_l.png Binary files differindex 6c86c82..4deb66a 100644 --- a/chrome/app/theme/large_omnibox_l.png +++ b/chrome/app/theme/large_omnibox_l.png diff --git a/chrome/app/theme/large_omnibox_r.png b/chrome/app/theme/large_omnibox_r.png Binary files differindex e2adad2..bc906cf 100644 --- a/chrome/app/theme/large_omnibox_r.png +++ b/chrome/app/theme/large_omnibox_r.png diff --git a/chrome/app/theme/large_tab_active_center.png b/chrome/app/theme/large_tab_active_center.png Binary files differindex 2fb4254..d968753 100644 --- a/chrome/app/theme/large_tab_active_center.png +++ b/chrome/app/theme/large_tab_active_center.png diff --git a/chrome/app/theme/large_tab_active_left.png b/chrome/app/theme/large_tab_active_left.png Binary files differindex 16c6122..e6cabf0 100644 --- a/chrome/app/theme/large_tab_active_left.png +++ b/chrome/app/theme/large_tab_active_left.png diff --git a/chrome/app/theme/large_tab_active_right.png b/chrome/app/theme/large_tab_active_right.png Binary files differindex 8af891f..8c37453 100644 --- a/chrome/app/theme/large_tab_active_right.png +++ b/chrome/app/theme/large_tab_active_right.png diff --git a/chrome/app/theme/large_tab_alpha_left.png b/chrome/app/theme/large_tab_alpha_left.png Binary files differindex 974fb86..546b068 100644 --- a/chrome/app/theme/large_tab_alpha_left.png +++ b/chrome/app/theme/large_tab_alpha_left.png diff --git a/chrome/app/theme/large_tab_alpha_right.png b/chrome/app/theme/large_tab_alpha_right.png Binary files differindex 363d85d..3a11cd9 100644 --- a/chrome/app/theme/large_tab_alpha_right.png +++ b/chrome/app/theme/large_tab_alpha_right.png diff --git a/chrome/app/theme/large_tab_close.png b/chrome/app/theme/large_tab_close.png Binary files differindex 3735519..34747b2 100644 --- a/chrome/app/theme/large_tab_close.png +++ b/chrome/app/theme/large_tab_close.png diff --git a/chrome/app/theme/large_tab_close_h.png b/chrome/app/theme/large_tab_close_h.png Binary files differindex 1460ded..44c34dd 100644 --- a/chrome/app/theme/large_tab_close_h.png +++ b/chrome/app/theme/large_tab_close_h.png diff --git a/chrome/app/theme/large_tab_close_mask.png b/chrome/app/theme/large_tab_close_mask.png Binary files differindex b4475e0..e50e756 100644 --- a/chrome/app/theme/large_tab_close_mask.png +++ b/chrome/app/theme/large_tab_close_mask.png diff --git a/chrome/app/theme/large_tab_close_p.png b/chrome/app/theme/large_tab_close_p.png Binary files differindex 00414bc..a05b257 100644 --- a/chrome/app/theme/large_tab_close_p.png +++ b/chrome/app/theme/large_tab_close_p.png diff --git a/chrome/app/theme/large_tab_inactive_center.png b/chrome/app/theme/large_tab_inactive_center.png Binary files differindex b8083ed..5ffda04 100644 --- a/chrome/app/theme/large_tab_inactive_center.png +++ b/chrome/app/theme/large_tab_inactive_center.png diff --git a/chrome/app/theme/large_tab_inactive_left.png b/chrome/app/theme/large_tab_inactive_left.png Binary files differindex 1e4b923..ddd69e0 100644 --- a/chrome/app/theme/large_tab_inactive_left.png +++ b/chrome/app/theme/large_tab_inactive_left.png diff --git a/chrome/app/theme/large_tab_inactive_right.png b/chrome/app/theme/large_tab_inactive_right.png Binary files differindex 2afcc4c..db6921e 100644 --- a/chrome/app/theme/large_tab_inactive_right.png +++ b/chrome/app/theme/large_tab_inactive_right.png diff --git a/chrome/app/theme/large_theme_frame_default2.png b/chrome/app/theme/large_theme_frame_default2.png Binary files differindex d7470e77..31a7fbb 100644 --- a/chrome/app/theme/large_theme_frame_default2.png +++ b/chrome/app/theme/large_theme_frame_default2.png diff --git a/chrome/app/theme/theme_frame_default2-incognito.png b/chrome/app/theme/theme_frame_default2-incognito.png Binary files differdeleted file mode 100644 index bb39a73..0000000 --- a/chrome/app/theme/theme_frame_default2-incognito.png +++ /dev/null diff --git a/chrome/app/theme/theme_frame_default_inactive2.png b/chrome/app/theme/theme_frame_default_inactive2.png Binary files differdeleted file mode 100644 index f42ce57..0000000 --- a/chrome/app/theme/theme_frame_default_inactive2.png +++ /dev/null diff --git a/chrome/app/theme/theme_frame_default_incognito2.png b/chrome/app/theme/theme_frame_default_incognito2.png Binary files differdeleted file mode 100644 index db12251..0000000 --- a/chrome/app/theme/theme_frame_default_incognito2.png +++ /dev/null diff --git a/chrome/app/theme/theme_frame_default_incognito_inactive2.png b/chrome/app/theme/theme_frame_default_incognito_inactive2.png Binary files differdeleted file mode 100644 index b681cd3..0000000 --- a/chrome/app/theme/theme_frame_default_incognito_inactive2.png +++ /dev/null diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 39d6fab..9b907d8 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -153,9 +153,6 @@ </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" /> - <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" /> <include name="IDR_NEWTAB_CHROME_WELCOME_PAGE_THUMBNAIL" file="ntp_welcome_thumb.png" type="BINDATA" /> <include name="IDR_NEWTAB_MENU_MASK" file="ntp_menu_mask.png" type="BINDATA" /> <include name="IDR_NEWTAB_OPTION" file="ntp_option.png" type="BINDATA" /> @@ -338,31 +335,7 @@ <if expr="is_macosx"> <include name="IDR_TABPOSE_CLOSE" file="tabpose_close.png" type="BINDATA" /> </if> - <include name="IDR_TAB_ACTIVE_CENTER" file="tab_active_center.png" type="BINDATA" /> - <include name="IDR_TAB_ACTIVE_LEFT" file="tab_active_left.png" type="BINDATA" /> - <include name="IDR_TAB_ACTIVE_RIGHT" file="tab_active_right.png" type="BINDATA" /> - <include name="IDR_TAB_ALPHA_LEFT" file="tab_alpha_left.png" type="BINDATA" /> - <include name="IDR_TAB_ALPHA_RIGHT" file="tab_alpha_right.png" type="BINDATA" /> - <include name="IDR_TAB_CLOSE" file="tab_close.png" type="BINDATA" /> - <include name="IDR_TAB_CLOSE_H" file="tab_close_h.png" type="BINDATA" /> - <include name="IDR_TAB_CLOSE_MASK" file="tab_close_mask.png" type="BINDATA" /> - <include name="IDR_TAB_CLOSE_P" file="tab_close_p.png" type="BINDATA" /> - <include name="IDR_TAB_DROP_DOWN" file="tab_drop_down.png" type="BINDATA" /> - <include name="IDR_TAB_DROP_UP" file="tab_drop_up.png" type="BINDATA" /> - <include name="IDR_TAB_INACTIVE_CENTER" file="tab_inactive_center.png" type="BINDATA" /> - <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')"> - <include name="IDR_THEME_FRAME_INACTIVE" file="theme_frame_default2.png" type="BINDATA" /> - <include name="IDR_THEME_FRAME_INCOGNITO" file="theme_frame_default2_incognito.png" type="BINDATA" /> - <include name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="theme_frame_default2_incognito.png" type="BINDATA" /> - </if> - <if expr="not pp_ifdef('chromeos')"> - <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" /> - </if> <include name="IDR_THEME_FRAME_OVERLAY" file="notused.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_OVERLAY_INACTIVE" file="notused.png" type="BINDATA" /> <include name="IDR_THEME_NTP_ATTRIBUTION" file="notused.png" type="BINDATA" /> diff --git a/chrome/app/theme/theme_resources_large.grd b/chrome/app/theme/theme_resources_large.grd index 6fd423f..ada7edc 100644 --- a/chrome/app/theme/theme_resources_large.grd +++ b/chrome/app/theme/theme_resources_large.grd @@ -88,6 +88,9 @@ <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_NEWTAB_BUTTON_H" file="large_newtab_h.png" type="BINDATA" /> + <include name="IDR_NEWTAB_BUTTON_MASK" file="large_newtab_button_mask.png" type="BINDATA" /> + <include name="IDR_NEWTAB_BUTTON_P" file="large_newtab_p.png" type="BINDATA" /> <include name="IDR_SETTINGS_FAVICON" file="large_settings_favicon.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" /> @@ -103,15 +106,35 @@ <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" /> + <include name="IDR_TAB_ACTIVE_CENTER" file="large_tab_active_center.png" type="BINDATA" /> + <include name="IDR_TAB_ACTIVE_LEFT" file="large_tab_active_left.png" type="BINDATA" /> + <include name="IDR_TAB_ACTIVE_RIGHT" file="large_tab_active_right.png" type="BINDATA" /> + <include name="IDR_TAB_ALPHA_LEFT" file="large_tab_alpha_left.png" type="BINDATA" /> + <include name="IDR_TAB_ALPHA_RIGHT" file="large_tab_alpha_right.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE" file="large_tab_close.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE_H" file="large_tab_close_h.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE_MASK" file="large_tab_close_mask.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE_P" file="large_tab_close_p.png" type="BINDATA" /> + <include name="IDR_TAB_DROP_DOWN" file="large_tab_drop_down.png" type="BINDATA" /> + <include name="IDR_TAB_DROP_UP" file="large_tab_drop_up.png" type="BINDATA" /> + <include name="IDR_TAB_INACTIVE_CENTER" file="large_tab_inactive_center.png" type="BINDATA" /> + <include name="IDR_TAB_INACTIVE_LEFT" file="large_tab_inactive_left.png" type="BINDATA" /> + <include name="IDR_TAB_INACTIVE_RIGHT" file="large_tab_inactive_right.png" type="BINDATA" /> <if expr="pp_ifdef('chromeos')"> <include name="IDR_THEME_FRAME" file="large_theme_frame_default2.png" type="BINDATA" /> + <include name="IDR_THEME_FRAME_INACTIVE" file="large_theme_frame_default2.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_LEFT" file="theme_frame_default2_upper_left.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_RIGHT" file="theme_frame_default2_upper_right.png" type="BINDATA" /> + <include name="IDR_THEME_FRAME_INCOGNITO" file="large_theme_frame_default2_incognito.png" type="BINDATA" /> + <include name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="large_theme_frame_default2_incognito.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INCOGNITO_LEFT" file="theme_frame_default2_incognito_upper_left.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INCOGNITO_RIGHT" file="theme_frame_default2_incognito_upper_right.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" /> </if> <if expr="pp_ifdef('chromeos')"> <include name="IDR_THEME_TAB_BACKGROUND" file="large_theme_tab_background2.png" type="BINDATA" /> diff --git a/chrome/app/theme/theme_resources_standard.grd b/chrome/app/theme/theme_resources_standard.grd index 69c8b3c..c614998 100644 --- a/chrome/app/theme/theme_resources_standard.grd +++ b/chrome/app/theme/theme_resources_standard.grd @@ -88,6 +88,9 @@ <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_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" /> <include name="IDR_SETTINGS_FAVICON" file="settings_favicon.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" /> @@ -103,15 +106,35 @@ <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" /> + <include name="IDR_TAB_ACTIVE_CENTER" file="tab_active_center.png" type="BINDATA" /> + <include name="IDR_TAB_ACTIVE_LEFT" file="tab_active_left.png" type="BINDATA" /> + <include name="IDR_TAB_ACTIVE_RIGHT" file="tab_active_right.png" type="BINDATA" /> + <include name="IDR_TAB_ALPHA_LEFT" file="tab_alpha_left.png" type="BINDATA" /> + <include name="IDR_TAB_ALPHA_RIGHT" file="tab_alpha_right.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE" file="tab_close.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE_H" file="tab_close_h.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE_MASK" file="tab_close_mask.png" type="BINDATA" /> + <include name="IDR_TAB_CLOSE_P" file="tab_close_p.png" type="BINDATA" /> + <include name="IDR_TAB_DROP_DOWN" file="tab_drop_down.png" type="BINDATA" /> + <include name="IDR_TAB_DROP_UP" file="tab_drop_up.png" type="BINDATA" /> + <include name="IDR_TAB_INACTIVE_CENTER" file="tab_inactive_center.png" type="BINDATA" /> + <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" /> <if expr="pp_ifdef('chromeos')"> <include name="IDR_THEME_FRAME" file="theme_frame_default2.png" type="BINDATA" /> + <include name="IDR_THEME_FRAME_INACTIVE" file="theme_frame_default2.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_LEFT" file="theme_frame_default2_upper_left.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_RIGHT" file="theme_frame_default2_upper_right.png" type="BINDATA" /> + <include name="IDR_THEME_FRAME_INCOGNITO" file="theme_frame_default2_incognito.png" type="BINDATA" /> + <include name="IDR_THEME_FRAME_INCOGNITO_INACTIVE" file="theme_frame_default2_incognito.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INCOGNITO_LEFT" file="theme_frame_default2_incognito_upper_left.png" type="BINDATA" /> <include name="IDR_THEME_FRAME_INCOGNITO_RIGHT" file="theme_frame_default2_incognito_upper_right.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" /> </if> <if expr="pp_ifdef('chromeos')"> <include name="IDR_THEME_TAB_BACKGROUND" file="theme_tab_background2.png" type="BINDATA" /> diff --git a/chrome/browser/chromeos/frame/panel_controller.cc b/chrome/browser/chromeos/frame/panel_controller.cc index 9be1fec..9a1c001 100644 --- a/chrome/browser/chromeos/frame/panel_controller.cc +++ b/chrome/browser/chromeos/frame/panel_controller.cc @@ -22,6 +22,7 @@ #include "content/common/notification_service.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" #include "third_party/skia/include/effects/SkBlurMaskFilter.h" diff --git a/chrome/browser/chromeos/notifications/balloon_view.cc b/chrome/browser/chromeos/notifications/balloon_view.cc index 756de0b..b1b4332 100644 --- a/chrome/browser/chromeos/notifications/balloon_view.cc +++ b/chrome/browser/chromeos/notifications/balloon_view.cc @@ -24,6 +24,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" #include "ui/base/models/simple_menu_model.h" #include "ui/base/resource/resource_bundle.h" diff --git a/chrome/browser/ui/touch/tabs/touch_tab.cc b/chrome/browser/ui/touch/tabs/touch_tab.cc index faccf75..7372e8c 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab.cc +++ b/chrome/browser/ui/touch/tabs/touch_tab.cc @@ -4,253 +4,17 @@ #include "chrome/browser/ui/touch/tabs/touch_tab.h" -#include "base/logging.h" -#include "chrome/browser/themes/theme_service.h" -#include "grit/theme_resources.h" -#include "grit/theme_resources_standard.h" -#include "grit/ui_resources.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/canvas_skia.h" -#include "ui/gfx/favicon_size.h" -#include "ui/gfx/path.h" -#include "ui/gfx/skbitmap_operations.h" - -static const int kLeftPadding = 16; -static const int kRightPadding = 15; -static const int kDropShadowHeight = 2; - -TouchTab::TouchTabImage TouchTab::tab_alpha = {0}; -TouchTab::TouchTabImage TouchTab::tab_active = {0}; -TouchTab::TouchTabImage TouchTab::tab_inactive = {0}; - //////////////////////////////////////////////////////////////////////////////// // TouchTab, public: TouchTab::TouchTab(TabController* controller) - : BaseTab(controller) { - InitTabResources(); + : Tab(controller) { } TouchTab::~TouchTab() { } -// static -gfx::Size TouchTab::GetMinimumUnselectedSize() { - InitTabResources(); - - gfx::Size minimum_size; - minimum_size.set_width(kLeftPadding + kRightPadding); - minimum_size.set_height(32); - return minimum_size; -} - -//////////////////////////////////////////////////////////////////////////////// -// TouchTab, protected: -const gfx::Rect& TouchTab::GetTitleBounds() const { - return title_bounds_; -} - -const gfx::Rect& TouchTab::GetIconBounds() const { - return favicon_bounds_; -} - -//////////////////////////////////////////////////////////////////////////////// -// TouchTab, views::View overrides: - -// We'll get selected via the mouse interactions with the TouchTabStrip. There -// is no need to directly handle the mouse movements in the TouchTab. - -bool TouchTab::OnMousePressed(const views::MouseEvent& event) { - return false; -} - -bool TouchTab::OnMouseDragged(const views::MouseEvent& event) { - return false; -} - -void TouchTab::OnMouseReleased(const views::MouseEvent& event) { -} - -void TouchTab::OnPaint(gfx::Canvas* canvas) { - // Don't paint if we're narrower than we can render correctly. (This should - // only happen during animations). - if (width() < GetMinimumUnselectedSize().width() && !data().mini) - return; - - PaintTabBackground(canvas); - - SkColor title_color = GetThemeProvider()-> - GetColor(IsSelected() ? - ThemeService::COLOR_TAB_TEXT : - ThemeService::COLOR_BACKGROUND_TAB_TEXT); - - PaintTitle(canvas, title_color); - PaintIcon(canvas); -} - -void TouchTab::Layout() { - gfx::Rect local_bounds = GetContentsBounds(); - TouchTabImage* tab_image = &tab_active; - TouchTabImage* alpha = &tab_alpha; - int image_height = alpha->image_l->height(); - int x_base = tab_image->image_l->width(); - int y_base = height() - image_height; - int center_width = width() - tab_image->l_width - tab_image->r_width; - if (center_width < 0) - center_width = 0; - title_bounds_ = gfx::Rect(x_base, y_base, center_width, image_height); - favicon_bounds_ = local_bounds; -} - -bool TouchTab::HasHitTestMask() const { - return true; -} - -void TouchTab::GetHitTestMask(gfx::Path* path) const { - DCHECK(path); - - SkScalar h = SkIntToScalar(height()); - SkScalar w = SkIntToScalar(width()); - - path->moveTo(0, h); - path->lineTo(0, 0); - path->lineTo(w, 0); - path->lineTo(w, h); - path->lineTo(0, h); - path->close(); -} - -//////////////////////////////////////////////////////////////////////////////// -// TouchTab, private: - -void TouchTab::PaintTabBackground(gfx::Canvas* canvas) { - if (IsSelected()) { - PaintActiveTabBackground(canvas); - } -} - -void TouchTab::PaintActiveTabBackground(gfx::Canvas* canvas) { - int offset = GetMirroredX() + background_offset_.x(); - ui::ThemeProvider* tp = GetThemeProvider(); - if (!tp) - NOTREACHED() << "Unable to get theme provider"; - - SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); - - TouchTabImage* tab_image = &tab_active; - TouchTabImage* alpha = &tab_alpha; - - // Draw left edge. - int image_height = alpha->image_l->height(); - int y_base = height() - image_height; - SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( - *tab_bg, offset, 0, tab_image->l_width, image_height); - SkBitmap theme_l = - SkBitmapOperations::CreateMaskedBitmap(tab_l, *alpha->image_l); - canvas->DrawBitmapInt(theme_l, 0, y_base); - - // Draw right edge. - SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, - offset + width() - tab_image->r_width, 0, - tab_image->r_width, image_height); - SkBitmap theme_r = - SkBitmapOperations::CreateMaskedBitmap(tab_r, *alpha->image_r); - canvas->DrawBitmapInt(theme_r, width() - tab_image->r_width, y_base); - - // Draw center. Instead of masking out the top portion we simply skip over it - // by incrementing by kDropShadowHeight, since it's a simple rectangle. - canvas->TileImageInt(*tab_bg, - offset + tab_image->l_width, - kDropShadowHeight + tab_image->y_offset, - tab_image->l_width, - y_base + kDropShadowHeight + tab_image->y_offset, - width() - tab_image->l_width - tab_image->r_width, - height() - kDropShadowHeight - tab_image->y_offset); - - // Now draw the highlights/shadows around the tab edge. - canvas->DrawBitmapInt(*tab_image->image_l, 0, y_base); - canvas->TileImageInt(*tab_image->image_c, tab_image->l_width, y_base, - width() - tab_image->l_width - tab_image->r_width, image_height); - canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, - y_base); -} - -void TouchTab::PaintIcon(gfx::Canvas* canvas) { - int x = favicon_bounds_.x(); - int y = favicon_bounds_.y(); - - TouchTabImage* tab_image = &tab_active; - int x_base = tab_image->image_l->width(); - - x += x_base; - - if (base::i18n::IsRTL()) { - x = width() - x - (data().favicon.isNull() - ? kTouchTargetIconSize : data().favicon.width()); - } - - if (data().network_state != TabRendererData::NETWORK_STATE_NONE) { - ui::ThemeProvider* tp = GetThemeProvider(); - SkBitmap frames(*tp->GetBitmapNamed( - (data().network_state == TabRendererData::NETWORK_STATE_WAITING) - ? IDR_THROBBER_WAITING : IDR_THROBBER)); - int image_size = frames.height(); - int image_offset = loading_animation_frame() * image_size; - canvas->DrawBitmapInt(frames, image_offset, 0, image_size, image_size, x, - y, kTouchTargetIconSize, kTouchTargetIconSize, false); - } else { - canvas->Save(); - canvas->ClipRectInt(0, 0, width(), height()); - if (should_display_crashed_favicon()) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - SkBitmap crashed_favicon(*rb.GetBitmapNamed(IDR_SAD_FAVICON)); - canvas->DrawBitmapInt(crashed_favicon, 0, 0, crashed_favicon.width(), - crashed_favicon.height(), x, y + favicon_hiding_offset(), - kTouchTargetIconSize, kTouchTargetIconSize, true); - } else { - if (!data().favicon.isNull()) { - // We center the image since it might not be square - canvas->DrawBitmapInt(data().favicon, - 0, 0, data().favicon.width(), data().favicon.height(), - x + ((kTouchTargetIconSize - data().favicon.width()) / 2), - y + ((kTouchTargetIconSize - data().favicon.height()) / 2) + - favicon_hiding_offset(), - data().favicon.width(), data().favicon.height(), true); - } - } - canvas->Restore(); - } -} - -// static -void TouchTab::InitTabResources() { - static bool initialized = false; - if (initialized) - return; - - initialized = true; - - // Load the tab images once now, and maybe again later if the theme changes. - LoadTabImages(); -} - -// static -void TouchTab::LoadTabImages() { - // We're not letting people override tab images just yet. - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - - tab_alpha.image_l = rb.GetBitmapNamed(IDR_TAB_ALPHA_LEFT); - tab_alpha.image_r = rb.GetBitmapNamed(IDR_TAB_ALPHA_RIGHT); - - tab_active.image_l = rb.GetBitmapNamed(IDR_TAB_ACTIVE_LEFT); - tab_active.image_c = rb.GetBitmapNamed(IDR_TAB_ACTIVE_CENTER); - tab_active.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); - tab_active.l_width = tab_active.image_l->width(); - tab_active.r_width = tab_active.image_r->width(); - - tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); - tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); - tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); - tab_inactive.l_width = tab_inactive.image_l->width(); - tab_inactive.r_width = tab_inactive.image_r->width(); +// We only show the close button for the active tab. +bool TouchTab::ShouldShowCloseBox() const { + return IsCloseable() && IsActive(); } diff --git a/chrome/browser/ui/touch/tabs/touch_tab.h b/chrome/browser/ui/touch/tabs/touch_tab.h index ec458aa..67ad7f9 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab.h +++ b/chrome/browser/ui/touch/tabs/touch_tab.h @@ -6,11 +6,7 @@ #define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ #pragma once -#include <string> - -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/ui/views/tabs/base_tab.h" -#include "ui/gfx/point.h" +#include "chrome/browser/ui/views/tabs/tab.h" /////////////////////////////////////////////////////////////////////////////// // @@ -18,25 +14,15 @@ // // A View that renders a TouchTab in a TouchTabStrip // -// TODO(wyck): Use transformable views for scrolling. /////////////////////////////////////////////////////////////////////////////// -class TouchTab : public BaseTab { +class TouchTab : public Tab { public: - // The menu button's class name. - static const char kViewClassName[]; - // The size of the favicon touch area. static const int kTouchTargetIconSize = 32; explicit TouchTab(TabController* controller); virtual ~TouchTab(); - // Set the background offset used to match the image in the inactive tab - // to the frame image. - void set_background_offset(const gfx::Point& offset) { - background_offset_ = offset; - } - // get and set touch icon void set_touch_icon(const SkBitmap& bitmap) { touch_icon_ = bitmap; @@ -45,64 +31,14 @@ class TouchTab : public BaseTab { return touch_icon_; } - // Returns the minimum possible size of a single unselected Tab. - static gfx::Size GetMinimumUnselectedSize(); - protected: - virtual const gfx::Rect& GetTitleBounds() const; - virtual const gfx::Rect& GetIconBounds() const; + // Returns whether the Tab should display a close button. + virtual bool ShouldShowCloseBox() const OVERRIDE; private: - // Overridden from views::View: - virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; - virtual void OnPaint(gfx::Canvas* canvas); - virtual void Layout(); - virtual bool HasHitTestMask() const; - virtual void GetHitTestMask(gfx::Path* path) const; - - // Paint various portions of the Tab - void PaintTabBackground(gfx::Canvas* canvas); - void PaintIcon(gfx::Canvas* canvas); - void PaintActiveTabBackground(gfx::Canvas* canvas); - - // TODO(wyck): will eventually add OnTouchEvent when the Touch Tab Strip - // requires touch-specific event handling. - - // Performs a one-time initialization of static resources such as tab images. - static void InitTabResources(); - - // Loads the images to be used for the tab background. - static void LoadTabImages(); - - // the bounds of the title text - gfx::Rect title_bounds_; - - // the bounds of the favicon - gfx::Rect favicon_bounds_; - - // The offset used to paint the inactive background image. - gfx::Point background_offset_; - // The touch icon found SkBitmap touch_icon_; - // 'l' is for left - // 'c' is for center - // 'r' is for right - struct TouchTabImage { - SkBitmap* image_l; - SkBitmap* image_c; - SkBitmap* image_r; - int l_width; - int r_width; - int y_offset; - }; - static TouchTabImage tab_active; - static TouchTabImage tab_inactive; - static TouchTabImage tab_alpha; - DISALLOW_COPY_AND_ASSIGN(TouchTab); }; diff --git a/chrome/browser/ui/touch/tabs/touch_tab_strip.cc b/chrome/browser/ui/touch/tabs/touch_tab_strip.cc index c4e3240..c39fe23 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab_strip.cc +++ b/chrome/browser/ui/touch/tabs/touch_tab_strip.cc @@ -4,370 +4,44 @@ #include "chrome/browser/ui/touch/tabs/touch_tab_strip.h" -#include <algorithm> -#include <cmath> - #include "chrome/browser/ui/touch/tabs/touch_tab.h" -#include "chrome/browser/ui/view_ids.h" -#include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" -#include "ui/gfx/canvas_skia.h" -#include "views/metrics.h" #include "views/widget/widget.h" -#include "views/window/non_client_view.h" - -static const int kTouchTabStripHeight = 64; -static const int kTouchTabWidth = 64; -static const int kTouchTabHeight = 64; -static const int kScrollThreshold = 4; TouchTabStrip::TouchTabStrip(TabStripController* controller) - : BaseTabStrip(controller, BaseTabStrip::HORIZONTAL_TAB_STRIP), - in_tab_close_(false), - last_tap_time_(base::Time::FromInternalValue(0)), - last_tapped_view_(NULL), - initial_mouse_x_(0), - initial_scroll_offset_(0), - scroll_offset_(0), - scrolling_(false), - initial_tab_(NULL), - min_scroll_offset_(0) { - Init(); + : TabStrip(controller) { } TouchTabStrip::~TouchTabStrip() { - // The animations may reference the tabs. Shut down the animation before we - // delete the tabs. - StopAnimating(false); - - DestroyDragController(); - - // The children (tabs) may callback to us from their destructor. Delete them - // so that if they call back we aren't in a weird state. - RemoveAllChildViews(true); -} - -//////////////////////////////////////////////////////////////////////////////// -// TouchTabStrip, AbstractTabStripView implementation: - -bool TouchTabStrip::IsPositionInWindowCaption(const gfx::Point& point) { - // The entire tabstrip is mine. No part of it belongs to the window caption. - return false; -} - -void TouchTabStrip::SetBackgroundOffset(const gfx::Point& offset) { - for (int i = 0; i < tab_count(); ++i) - GetTabAtTabDataIndex(i)->set_background_offset(offset); -} - -views::View* TouchTabStrip::GetNewTabButton() { - return NULL; } -//////////////////////////////////////////////////////////////////////////////// -// TouchTabStrip, BaseTabStrip implementation: - -void TouchTabStrip::PrepareForCloseAt(int model_index) { - if (!in_tab_close_ && IsAnimating()) { - // Cancel any current animations. We do this as remove uses the current - // ideal bounds and we need to know ideal bounds is in a good state. - StopAnimating(true); - } - - in_tab_close_ = true; -} - -void TouchTabStrip::StartHighlight(int model_index) { -} - -void TouchTabStrip::StopAllHighlighting() { -} - -BaseTab* TouchTabStrip::CreateTabForDragging() { - return NULL; -} - -void TouchTabStrip::RemoveTabAt(int model_index) { - StartRemoveTabAnimation(model_index); -} - -void TouchTabStrip::SetSelection( - const TabStripSelectionModel& old_selection, - const TabStripSelectionModel& new_selection) { - SchedulePaint(); -} - -void TouchTabStrip::TabTitleChangedNotLoading(int model_index) { -} - -BaseTab* TouchTabStrip::CreateTab() { - return new TouchTab(this); -} - -void TouchTabStrip::StartInsertTabAnimation(int model_index) { - PrepareForAnimation(); - - in_tab_close_ = false; - - GenerateIdealBounds(); - - int tab_data_index = ModelIndexToTabIndex(model_index); - BaseTab* tab = base_tab_at_tab_index(tab_data_index); - if (model_index == 0) { - tab->SetBounds(0, ideal_bounds(tab_data_index).y(), 0, - ideal_bounds(tab_data_index).height()); - } else { - BaseTab* last_tab = base_tab_at_tab_index(tab_data_index - 1); - tab->SetBounds(last_tab->bounds().right(), - ideal_bounds(tab_data_index).y(), 0, - ideal_bounds(tab_data_index).height()); - } - - AnimateToIdealBounds(); -} - -void TouchTabStrip::AnimateToIdealBounds() { - for (int i = 0; i < tab_count(); ++i) { - TouchTab* tab = GetTabAtTabDataIndex(i); - if (!tab->closing() && !tab->dragging()) - bounds_animator().AnimateViewTo(tab, ideal_bounds(i)); - } -} - -bool TouchTabStrip::ShouldHighlightCloseButtonAfterRemove() { - return in_tab_close_; -} - -void TouchTabStrip::GenerateIdealBounds() { - gfx::Rect bounds; - int tab_x = 0; - int tab_y = 0; - for (int i = 0; i < tab_count(); ++i) { - TouchTab* tab = GetTabAtTabDataIndex(i); - if (!tab->closing()) { - int x = tab_x + scroll_offset_; - if (tab->IsSelected()) { - // limit the extent to which this tab can be displaced. - x = std::min(std::max(0, x), width() - kTouchTabWidth); - } - set_ideal_bounds(i, gfx::Rect(x, tab_y, - kTouchTabWidth, kTouchTabHeight)); - // offset the next tab to the right by the width of this tab - tab_x += kTouchTabWidth; - } - } - min_scroll_offset_ = std::min(0, width() - tab_x); +void TouchTabStrip::OnDragEntered(const views::DropTargetEvent& event) { + // TODO(saintlou): To implement or to ignore? + NOTIMPLEMENTED(); } -void TouchTabStrip::LayoutDraggedTabsAt(const std::vector<BaseTab*>& tabs, - BaseTab* active_tab, - const gfx::Point& location, - bool initial_drag) { - // Not needed as dragging isn't supported. +int TouchTabStrip::OnDragUpdated(const views::DropTargetEvent& event) { + // TODO(saintlou): To implement or to ignore? NOTIMPLEMENTED(); + return 0; } -void TouchTabStrip::CalculateBoundsForDraggedTabs( - const std::vector<BaseTab*>& tabs, - std::vector<gfx::Rect>* bounds) { - // Not needed as dragging isn't supported. +void TouchTabStrip::OnDragExited() { + // TODO(saintlou): To implement or to ignore? NOTIMPLEMENTED(); } -int TouchTabStrip::GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs) { - // Not needed as dragging isn't supported. +int TouchTabStrip::OnPerformDrop(const views::DropTargetEvent& event) { + // TODO(saintlou): To implement or to ignore? NOTIMPLEMENTED(); return 0; } -// TODO(wyck): Someday we might like to get a "scroll" interaction event by way -// of views, triggered by the gesture manager, and/or mouse scroll wheel. -// For now, we're just handling a single scroll with these mouse events: -// OnMousePressed, OnMouseDragged, and OnMouseReleased. - -bool TouchTabStrip::OnMousePressed(const views::MouseEvent& event) { - // When we press the mouse button, we begin a drag - BeginScroll(event.location()); - return true; -} - -bool TouchTabStrip::OnMouseDragged(const views::MouseEvent& event) { - ContinueScroll(event.location()); - return true; -} - -void TouchTabStrip::OnMouseReleased(const views::MouseEvent& event) { - EndScroll(event.location()); -} - -void TouchTabStrip::OnMouseCaptureLost() { - CancelScroll(); -} - -void TouchTabStrip::BeginScroll(const gfx::Point& point ) { - initial_mouse_x_ = point.x(); - initial_scroll_offset_ = scroll_offset_; - initial_tab_ = static_cast<TouchTab*>(GetTabAtLocal(point)); -} - -void TouchTabStrip::ContinueScroll(const gfx::Point& point) { - int delta_x = point.x() - initial_mouse_x_; - if (std::abs(delta_x) > kScrollThreshold) - scrolling_ = true; - if (scrolling_) - ScrollTo(delta_x); - DoLayout(); - SchedulePaint(); -} - -void TouchTabStrip::EndScroll(const gfx::Point& point) { - int delta_x = point.x() - initial_mouse_x_; - if (scrolling_) { - scrolling_ = false; - ScrollTo(delta_x); - StopAnimating(false); - GenerateIdealBounds(); - AnimateToIdealBounds(); - } else { - TouchTab* tab = static_cast<TouchTab*>(GetTabAtLocal(point)); - if (tab && tab == initial_tab_) - SelectTab(tab); - DoLayout(); - SchedulePaint(); - } - initial_tab_ = NULL; -} - -void TouchTabStrip::CancelScroll() { - // Cancel the scroll by scrolling back to the initial position (deltax = 0). - ScrollTo(0); - StopAnimating(false); - GenerateIdealBounds(); - AnimateToIdealBounds(); -} - -void TouchTabStrip::ScrollTo(int delta_x) { - scroll_offset_ = initial_scroll_offset_ + delta_x; - // Limit the scrolling here. - // When scrolling beyond the limits of min and max offsets, the displacement - // is adjusted to 25% of what would normally applied (divided by 4). - // Perhaps in the future, Hooke's law could be used to model more physically - // based spring-like behavior. - int max_scroll_offset = 0; // Because there's never content to the left of 0. - if (scroll_offset_ > max_scroll_offset) { - if (scrolling_) { - scroll_offset_ = max_scroll_offset - + std::min((scroll_offset_ - max_scroll_offset) / 4, - kTouchTabWidth); - } else { - scroll_offset_ = max_scroll_offset; - } - } - if (scroll_offset_ < min_scroll_offset_) { - if (scrolling_) { - scroll_offset_ = min_scroll_offset_ - + std::max((scroll_offset_ - min_scroll_offset_) / 4, - -kTouchTabWidth); - } else { - scroll_offset_ = min_scroll_offset_; - } - } -} - -TouchTab* TouchTabStrip::GetTabAtTabDataIndex(int tab_data_index) const { - return static_cast<TouchTab*>(base_tab_at_tab_index(tab_data_index)); -} - -// Retrieves the Tab at the specified *model* index. -TouchTab* TouchTabStrip::GetTouchTabAtModelIndex(int model_index) const { - return static_cast<TouchTab*>(GetBaseTabAtModelIndex(model_index)); -} - -//////////////////////////////////////////////////////////////////////////////// -// TouchTabStrip, private: - -void TouchTabStrip::Init() { - set_id(VIEW_ID_TAB_STRIP); -} - -//////////////////////////////////////////////////////////////////////////////// -// TouchTabStrip, views::View overrides, private: - -gfx::Size TouchTabStrip::GetPreferredSize() { - return gfx::Size(0, kTouchTabStripHeight); -} - -void TouchTabStrip::PaintChildren(gfx::Canvas* canvas) { - // Tabs are painted in reverse order, so they stack to the left. - TouchTab* selected_tab = NULL; - TouchTab* dragging_tab = NULL; - - for (int i = tab_count() - 1; i >= 0; --i) { - TouchTab* tab = GetTabAtTabDataIndex(i); - // We must ask the _Tab's_ model, not ourselves, because in some situations - // the model will be different to this object, e.g. when a Tab is being - // removed after its TabContents has been destroyed. - if (tab->dragging()) { - dragging_tab = tab; - } else if (!tab->IsSelected()) { - tab->Paint(canvas); - } else { - selected_tab = tab; - } - } - - if (GetWidget()->ShouldUseNativeFrame()) { - // Make sure unselected tabs are somewhat transparent. - SkPaint paint; - paint.setColor(SkColorSetARGB(200, 255, 255, 255)); - paint.setXfermodeMode(SkXfermode::kDstIn_Mode); - paint.setStyle(SkPaint::kFill_Style); - canvas->DrawRectInt(0, 0, width(), - height() - 2, // Visible region that overlaps the toolbar. - paint); - } - - // Paint the selected tab last, so it overlaps all the others. - if (selected_tab) - selected_tab->Paint(canvas); - - // And the dragged tab. - if (dragging_tab) - dragging_tab->Paint(canvas); +BaseTab* TouchTabStrip::CreateTab() { + return new TouchTab(this); } -ui::TouchStatus TouchTabStrip::OnTouchEvent( - const views::TouchEvent& event) { - if (event.type() != ui::ET_TOUCH_PRESSED) - return ui::TOUCH_STATUS_UNKNOWN; - - views::View* view = GetEventHandlerForPoint(event.location()); - if (view && view != this && view->id() != VIEW_ID_TAB) - return ui::TOUCH_STATUS_UNKNOWN; - - base::TimeDelta delta = event.time_stamp() - last_tap_time_; - - if (delta.InMilliseconds() < views::GetDoubleClickInterval() && - view == last_tapped_view_) { - // If double tapped the empty space, open a new tab. If double tapped a tab, - // close it. - if (view == this) - controller()->CreateNewTab(); - else - CloseTab(static_cast<BaseTab*>(view)); - - last_tap_time_ = base::Time::FromInternalValue(0); - last_tapped_view_ = NULL; - return ui::TOUCH_STATUS_END; - } - - last_tap_time_ = event.time_stamp(); - last_tapped_view_ = view; +ui::TouchStatus TouchTabStrip::OnTouchEvent(const views::TouchEvent& event) { + // TODO(saintlou): To implement. + NOTIMPLEMENTED(); return ui::TOUCH_STATUS_UNKNOWN; } - -void TouchTabStrip::ViewHierarchyChanged(bool is_add, - View* parent, - View* child) { - if (!is_add && last_tapped_view_ == child) - last_tapped_view_ = NULL; -} diff --git a/chrome/browser/ui/touch/tabs/touch_tab_strip.h b/chrome/browser/ui/touch/tabs/touch_tab_strip.h index 1ecaa68..dd8e560 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab_strip.h +++ b/chrome/browser/ui/touch/tabs/touch_tab_strip.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_ #pragma once -#include "chrome/browser/ui/views/tabs/base_tab_strip.h" +#include "chrome/browser/ui/views/tabs/tab_strip.h" namespace ui { enum TouchStatus; @@ -19,124 +19,26 @@ class TouchTab; // // TouchTabStrip // -// A View that represents the TabStripModel. The TouchTabStrip has the -// following responsibilities: -// - It implements the TabStripModelObserver interface, and acts as a -// container for Tabs, and is also responsible for creating them. +// A View that overrides Touch specific behavior. // -// TODO(wyck): Use transformable views for scrolling. /////////////////////////////////////////////////////////////////////////////// -class TouchTabStrip : public BaseTabStrip { +class TouchTabStrip : public TabStrip { public: explicit TouchTabStrip(TabStripController* controller); virtual ~TouchTabStrip(); - // AbstractTabStripView implementation: - virtual bool IsPositionInWindowCaption(const gfx::Point& point) OVERRIDE; - virtual void SetBackgroundOffset(const gfx::Point& offset) OVERRIDE; - virtual views::View* GetNewTabButton() OVERRIDE; - - // BaseTabStrip implementation: - virtual void PrepareForCloseAt(int model_index); - virtual void StartHighlight(int model_index); - virtual void StopAllHighlighting(); - virtual BaseTab* CreateTabForDragging(); - virtual void RemoveTabAt(int model_index); - virtual void SetSelection(const TabStripSelectionModel& old_selection, - const TabStripSelectionModel& new_selection); - virtual void TabTitleChangedNotLoading(int model_index); - virtual BaseTab* CreateTab(); - virtual void StartInsertTabAnimation(int model_index); - virtual void AnimateToIdealBounds(); - virtual bool ShouldHighlightCloseButtonAfterRemove(); - virtual void GenerateIdealBounds(); - virtual void LayoutDraggedTabsAt(const std::vector<BaseTab*>& tabs, - BaseTab* active_tab, - const gfx::Point& location, - bool initial_drag); - virtual void CalculateBoundsForDraggedTabs( - const std::vector<BaseTab*>& tabs, - std::vector<gfx::Rect>* bounds); - virtual int GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs); - // views::View overrides: - virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; - virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; - virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; - virtual void OnMouseCaptureLost() OVERRIDE; - - // Retrieves the Tab at the specified index. Remember, the specified index - // is in terms of tab_data, *not* the model. - TouchTab* GetTabAtTabDataIndex(int tab_data_index) const; + virtual void OnDragEntered(const views::DropTargetEvent& event) OVERRIDE; + virtual int OnDragUpdated(const views::DropTargetEvent& event) OVERRIDE; + virtual void OnDragExited() OVERRIDE; + virtual int OnPerformDrop(const views::DropTargetEvent& event) OVERRIDE; - // Retrieves the Tab at the specified *model* index. - TouchTab* GetTouchTabAtModelIndex(int model_index) const; + protected: + // BaseTabStrip overrides: + virtual BaseTab* CreateTab() OVERRIDE; private: - void Init(); - - // Overridden from views::View. - virtual gfx::Size GetPreferredSize() OVERRIDE; - virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; virtual ui::TouchStatus OnTouchEvent(const views::TouchEvent& event) OVERRIDE; - virtual void ViewHierarchyChanged(bool is_add, - View* parent, - View* child) OVERRIDE; - - // Adjusts the state of scroll interaction when a mouse press occurs at the - // given point. Sets an appropriate |initial_scroll_offset_|. - void BeginScroll(const gfx::Point& point); - - // Adjusts the state of scroll interaction when the mouse is dragged to the - // given point. If the scroll is not beyond the minimum threshold, the tabs - // will not actually scroll. - void ContinueScroll(const gfx::Point& point); - - // Adjusts the state of scroll interaction when the mouse is released. Either - // scrolls to the final mouse release point or selects the current tab - // depending on whether the mouse was dragged beyone the minimum threshold. - void EndScroll(const gfx::Point& point); - - // Adjust the state of scroll interaction when the mouse capture is lost. It - // scrolls back to the original position before the scroll began. - void CancelScroll(); - - // Adjust the positions of the tabs to perform a scroll of |delta_x| relative - // to the |initial_scroll_offset_|. - void ScrollTo(int delta_x); - - // True if PrepareForCloseAt has been invoked. When true remove animations - // preserve current tab bounds. - bool in_tab_close_; - - // Last time the tabstrip was tapped. - base::Time last_tap_time_; - - // The view that was tapped last. - View* last_tapped_view_; - - // Records the mouse x coordinate at the start of a drag operation. - int initial_mouse_x_; - - // Records the scroll offset at the time of the start of a drag operation. - int initial_scroll_offset_; - - // The current offset of the view. Positive scroll offsets move the icons to - // the left. Negative scroll offsets move the icons to the right. - int scroll_offset_; - - // State of the scrolling interaction. Will be true once the drag has been - // displaced beyond the minimum dragging threshold. - bool scrolling_; - - // Records the tab that was under the initial mouse press. Must match the - // tab that was under the final mouse release in order for the tab to - // be selected. - TouchTab* initial_tab_; - - // The minimum value that |scroll_offset_| can have. Based on the total - // width of all the content to be scrolled, less the viewport size. - int min_scroll_offset_; DISALLOW_COPY_AND_ASSIGN(TouchTabStrip); }; diff --git a/chrome/browser/ui/touch/tabs/touch_tab_strip_controller.cc b/chrome/browser/ui/touch/tabs/touch_tab_strip_controller.cc index e6ed8fc..c745d7d 100644 --- a/chrome/browser/ui/touch/tabs/touch_tab_strip_controller.cc +++ b/chrome/browser/ui/touch/tabs/touch_tab_strip_controller.cc @@ -55,7 +55,8 @@ TouchTabStripController::~TouchTabStripController() { void TouchTabStripController::TabDetachedAt(TabContentsWrapper* contents, int model_index) { if (consumer_.HasPendingRequests()) { - TouchTab* touch_tab = tabstrip()->GetTouchTabAtModelIndex(model_index); + TouchTab* touch_tab = + static_cast<TouchTab*>(tabstrip()->GetBaseTabAtModelIndex(model_index)); consumer_.CancelAllRequestsForClientData(touch_tab); } BrowserTabStripController::TabDetachedAt(contents, model_index); @@ -66,8 +67,9 @@ void TouchTabStripController::TabChangedAt(TabContentsWrapper* contents, TabChangeType change_type) { // Clear the large icon if we are loading a different URL in the same tab. if (change_type == LOADING_ONLY) { - TouchTab* touch_tab = tabstrip()->GetTouchTabAtModelIndex(model_index); - if (!touch_tab->touch_icon().isNull()) { + TouchTab* touch_tab = + static_cast<TouchTab*>(tabstrip()->GetBaseTabAtModelIndex(model_index)); + if (!touch_tab->touch_icon().isNull()) { GURL existing_tab_url = GetURLWithoutFragment(touch_tab->data().url); GURL page_url = GetURLWithoutFragment(contents->tab_contents()->GetURL()); // Reset touch icon if the url are different. @@ -94,8 +96,9 @@ void TouchTabStripController::SetTabRendererDataFromModel( return; // Use the touch icon if any. - TouchTab* touch_tab = tabstrip()->GetTouchTabAtModelIndex(model_index); - if (!touch_tab->touch_icon().isNull()) { + TouchTab* touch_tab = + static_cast<TouchTab*>(tabstrip()->GetBaseTabAtModelIndex(model_index)); + if (!touch_tab->touch_icon().isNull()) { data->favicon = touch_tab->touch_icon(); return; } 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 7737545..7edc12b 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -76,7 +76,11 @@ TabContents* GetTabContentsFromDelegate(LocationBarView::Delegate* delegate) { // static const int LocationBarView::kNormalHorizontalEdgeThickness = 1; const int LocationBarView::kVerticalEdgeThickness = 2; +#if defined(TOUCH_UI) +const int LocationBarView::kItemPadding = 10; +#else const int LocationBarView::kItemPadding = 3; +#endif const int LocationBarView::kIconInternalPadding = 2; const int LocationBarView::kEdgeItemPadding = kItemPadding; const int LocationBarView::kBubbleHorizontalPadding = 1; diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index 44c1364..cd5f249 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -430,10 +430,6 @@ void BaseTab::PaintIcon(gfx::Canvas* canvas) { if (bounds.IsEmpty()) return; - // The size of bounds has to be kFaviconSize x kFaviconSize. - DCHECK_EQ(kFaviconSize, bounds.width()); - DCHECK_EQ(kFaviconSize, bounds.height()); - bounds.set_x(GetMirroredXForRect(bounds)); if (data().network_state != TabRendererData::NETWORK_STATE_NONE) { diff --git a/chrome/browser/ui/views/tabs/side_tab.cc b/chrome/browser/ui/views/tabs/side_tab.cc index 576728f..8f06495 100644 --- a/chrome/browser/ui/views/tabs/side_tab.cc +++ b/chrome/browser/ui/views/tabs/side_tab.cc @@ -6,6 +6,7 @@ #include "base/utf_string_conversions.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index b675565..60606f2 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -38,7 +38,13 @@ static const int kFaviconTitleSpacing = 4; static const int kTitleCloseButtonSpacing = 3; static const int kStandardTitleWidth = 175; static const int kCloseButtonVertFuzz = 0; +#if defined(TOUCH_UI) +static const int kTabIconSize = 32; +static const int kCloseButtonHorzFuzz = -10; +#else +static const int kTabIconSize = kFaviconSize; static const int kCloseButtonHorzFuzz = 5; +#endif // Vertical adjustment to the favicon when the tab has a large icon. static const int kAppTapFaviconVerticalAdjustment = 2; @@ -233,7 +239,7 @@ void Tab::Layout() { // The height of the content of the Tab is the largest of the favicon, // the title text and the close button graphic. - int content_height = std::max(kFaviconSize, font_height()); + int content_height = std::max(kTabIconSize, font_height()); gfx::Size close_button_size(close_button()->GetPreferredSize()); content_height = std::max(content_height, close_button_size.height()); @@ -241,17 +247,17 @@ void Tab::Layout() { showing_icon_ = ShouldShowIcon(); if (showing_icon_) { // Use the size of the favicon as apps use a bigger favicon size. - int favicon_top = kTopPadding + content_height / 2 - kFaviconSize / 2; + int favicon_top = kTopPadding + content_height / 2 - kTabIconSize / 2; int favicon_left = lb.x(); favicon_bounds_.SetRect(favicon_left, favicon_top, - kFaviconSize, kFaviconSize); + kTabIconSize, kTabIconSize); if (data().mini && width() < kMiniTabRendererAsNormalTabWidth) { // Adjust the location of the favicon when transitioning from a normal // tab to a mini-tab. int mini_delta = kMiniTabRendererAsNormalTabWidth - GetMiniWidth(); int ideal_delta = width() - GetMiniWidth(); if (ideal_delta < mini_delta) { - int ideal_x = (GetMiniWidth() - kFaviconSize) / 2; + int ideal_x = (GetMiniWidth() - kTabIconSize) / 2; int x = favicon_bounds_.x() + static_cast<int>( (1 - static_cast<float>(ideal_delta) / static_cast<float>(mini_delta)) * @@ -612,7 +618,7 @@ SkBitmap Tab::DrawHoverGlowBitmap(int width_input, int height_input) { int Tab::IconCapacity() const { if (height() < GetMinimumUnselectedSize().height()) return 0; - return (width() - kLeftPadding - kRightPadding) / kFaviconSize; + return (width() - kLeftPadding - kRightPadding) / kTabIconSize; } bool Tab::ShouldShowIcon() const { diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h index 1198fac..a395656 100644 --- a/chrome/browser/ui/views/tabs/tab.h +++ b/chrome/browser/ui/views/tabs/tab.h @@ -61,6 +61,9 @@ class Tab : public BaseTab { virtual const gfx::Rect& GetIconBounds() const OVERRIDE; virtual void DataChanged(const TabRendererData& old) OVERRIDE; + // Returns whether the Tab should display a close button. + virtual bool ShouldShowCloseBox() const; + private: // Overridden from views::View: virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; @@ -87,9 +90,6 @@ class Tab : public BaseTab { // Returns whether the Tab should display a favicon. bool ShouldShowIcon() const; - // Returns whether the Tab should display a close button. - bool ShouldShowCloseBox() const; - // Gets the throb value for the tab. When a tab is not selected the // active background is drawn at |GetThrobValue()|%. This is used for hover, // mini tab title change and pulsing. diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 6b6894b3..8b431e6 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -560,6 +560,23 @@ void TabStrip::ButtonPressed(views::Button* sender, const views::Event& event) { } /////////////////////////////////////////////////////////////////////////////// +// TabStrip, protected: + +Tab* TabStrip::GetTabAtTabDataIndex(int tab_data_index) const { + return static_cast<Tab*>(base_tab_at_tab_index(tab_data_index)); +} + +Tab* TabStrip::GetTabAtModelIndex(int model_index) const { + return GetTabAtTabDataIndex(ModelIndexToTabIndex(model_index)); +} + +void TabStrip::GetCurrentTabWidths(double* unselected_width, + double* selected_width) const { + *unselected_width = current_unselected_width_; + *selected_width = current_selected_width_; +} + +/////////////////////////////////////////////////////////////////////////////// // TabStrip, private: void TabStrip::Init() { @@ -608,20 +625,6 @@ void TabStrip::LoadNewTabButtonImage() { delete tp; } -Tab* TabStrip::GetTabAtTabDataIndex(int tab_data_index) const { - return static_cast<Tab*>(base_tab_at_tab_index(tab_data_index)); -} - -Tab* TabStrip::GetTabAtModelIndex(int model_index) const { - return GetTabAtTabDataIndex(ModelIndexToTabIndex(model_index)); -} - -void TabStrip::GetCurrentTabWidths(double* unselected_width, - double* selected_width) const { - *unselected_width = current_unselected_width_; - *selected_width = current_selected_width_; -} - void TabStrip::GetDesiredTabWidths(int tab_count, int mini_tab_count, double* unselected_width, diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index 009cf2a..0f71a4d 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h @@ -109,6 +109,23 @@ class TabStrip : public BaseTabStrip, // Horizontal gap between mini and non-mini-tabs. static const int mini_to_non_mini_gap_; + protected: + // Retrieves the Tab at the specified index. Remember, the specified index + // is in terms of tab_data, *not* the model. + Tab* GetTabAtTabDataIndex(int tab_data_index) const; + + // Returns the tab at the specified index. If a remove animation is on going + // and the index is >= the index of the tab being removed, the index is + // incremented. While a remove operation is on going the indices of the model + // do not line up with the indices of the view. This method adjusts the index + // accordingly. + // + // Use this instead of GetTabAtTabDataIndex if the index comes from the model. + Tab* GetTabAtModelIndex(int model_index) const; + + // Returns the number of mini-tabs. + int GetMiniTabCount() const; + private: friend class DraggedTabController; @@ -146,22 +163,6 @@ class TabStrip : public BaseTabStrip, // Set the images for the new tab button. void LoadNewTabButtonImage(); - // Retrieves the Tab at the specified index. Remember, the specified index - // is in terms of tab_data, *not* the model. - Tab* GetTabAtTabDataIndex(int tab_data_index) const; - - // Returns the tab at the specified index. If a remove animation is on going - // and the index is >= the index of the tab being removed, the index is - // incremented. While a remove operation is on going the indices of the model - // do not line up with the indices of the view. This method adjusts the index - // accordingly. - // - // Use this instead of GetTabAtTabDataIndex if the index comes from the model. - Tab* GetTabAtModelIndex(int model_index) const; - - // Returns the number of mini-tabs. - int GetMiniTabCount() const; - // -- Tab Resize Layout ----------------------------------------------------- // Returns the exact (unrounded) current width of each tab. @@ -257,8 +258,13 @@ class TabStrip : public BaseTabStrip, // able to lay it out before we are able to get its image from the // ui::ThemeProvider. It also makes sense to do this, because the size of the // new tab button should not need to be calculated dynamically. +#if defined(TOUCH_UI) + static const int kNewTabButtonWidth = 66; + static const int kNewTabButtonHeight = 39; +#else static const int kNewTabButtonWidth = 28; static const int kNewTabButtonHeight = 18; +#endif // Valid for the lifetime of a drag over us. scoped_ptr<DropInfo> drop_info_; |