Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: chrome/browser/ui/touch/tabs/touch_tab.h

Issue 7065052: Improve large tab strip by leveraging touch icons when present (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renaming as per tfarina Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ 5 #ifndef CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_
6 #define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ 6 #define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/ui/views/tabs/base_tab.h" 12 #include "chrome/browser/ui/views/tabs/base_tab.h"
13 #include "ui/gfx/point.h" 13 #include "ui/gfx/point.h"
14 14
15 // The size of the favicon touch area.
16 const int kTouchTargetIconSize = 32;
sky 2011/06/17 15:34:55 Make this is a static field of TouchTab, just like
Emmanuel Saint-loubert-Bié 2011/06/17 16:11:23 Done.
17
15 /////////////////////////////////////////////////////////////////////////////// 18 ///////////////////////////////////////////////////////////////////////////////
16 // 19 //
17 // TouchTab 20 // TouchTab
18 // 21 //
19 // A View that renders a TouchTab in a TouchTabStrip 22 // A View that renders a TouchTab in a TouchTabStrip
20 // 23 //
21 // TODO(wyck): Use transformable views for scrolling. 24 // TODO(wyck): Use transformable views for scrolling.
22 /////////////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////////////////////////////////////////
23 class TouchTab : public BaseTab { 26 class TouchTab : public BaseTab {
24 public: 27 public:
25 // The menu button's class name. 28 // The menu button's class name.
26 static const char kViewClassName[]; 29 static const char kViewClassName[];
27 30
28 explicit TouchTab(TabController* controller); 31 explicit TouchTab(TabController* controller);
29 virtual ~TouchTab(); 32 virtual ~TouchTab();
30 33
31 // Set the background offset used to match the image in the inactive tab 34 // Set the background offset used to match the image in the inactive tab
32 // to the frame image. 35 // to the frame image.
33 void set_background_offset(const gfx::Point& offset) { 36 void set_background_offset(const gfx::Point& offset) {
34 background_offset_ = offset; 37 background_offset_ = offset;
35 } 38 }
36 39
40 // get and set touch icon
41 void set_touch_icon(const SkBitmap& bitmap) {
42 touch_icon_ = bitmap;
43 }
44 const SkBitmap& touch_icon() const {
45 return touch_icon_;
46 }
47
37 // Returns the minimum possible size of a single unselected Tab. 48 // Returns the minimum possible size of a single unselected Tab.
38 static gfx::Size GetMinimumUnselectedSize(); 49 static gfx::Size GetMinimumUnselectedSize();
39 50
40 protected: 51 protected:
41 virtual const gfx::Rect& GetTitleBounds() const; 52 virtual const gfx::Rect& GetTitleBounds() const;
42 virtual const gfx::Rect& GetIconBounds() const; 53 virtual const gfx::Rect& GetIconBounds() const;
43 54
44 private: 55 private:
45 // Overridden from views::View: 56 // Overridden from views::View:
46 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; 57 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
(...skipping 20 matching lines...) Expand all
67 78
68 // the bounds of the title text 79 // the bounds of the title text
69 gfx::Rect title_bounds_; 80 gfx::Rect title_bounds_;
70 81
71 // the bounds of the favicon 82 // the bounds of the favicon
72 gfx::Rect favicon_bounds_; 83 gfx::Rect favicon_bounds_;
73 84
74 // The offset used to paint the inactive background image. 85 // The offset used to paint the inactive background image.
75 gfx::Point background_offset_; 86 gfx::Point background_offset_;
76 87
88 // The touch icon found
89 SkBitmap touch_icon_;
90
77 // 'l' is for left 91 // 'l' is for left
78 // 'c' is for center 92 // 'c' is for center
79 // 'r' is for right 93 // 'r' is for right
80 struct TouchTabImage { 94 struct TouchTabImage {
81 SkBitmap* image_l; 95 SkBitmap* image_l;
82 SkBitmap* image_c; 96 SkBitmap* image_c;
83 SkBitmap* image_r; 97 SkBitmap* image_r;
84 int l_width; 98 int l_width;
85 int r_width; 99 int r_width;
86 int y_offset; 100 int y_offset;
87 }; 101 };
88 static TouchTabImage tab_active; 102 static TouchTabImage tab_active;
89 static TouchTabImage tab_inactive; 103 static TouchTabImage tab_inactive;
90 static TouchTabImage tab_alpha; 104 static TouchTabImage tab_alpha;
91 105
92 DISALLOW_COPY_AND_ASSIGN(TouchTab); 106 DISALLOW_COPY_AND_ASSIGN(TouchTab);
93 }; 107 };
94 108
95 #endif // CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_ 109 #endif // CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698