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

Side by Side Diff: chrome/browser/views/tabs/side_tab.h

Issue 1001003: Allow dynamic switching in and out of sidetabs mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_VIEWS_TABS_SIDE_TAB_H_ 5 #ifndef CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_H_
6 #define CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_H_ 6 #define CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_H_
7 7
8 #include "app/gfx/font.h" 8 #include "app/gfx/font.h"
9 #include "app/slide_animation.h" 9 #include "app/slide_animation.h"
10 #include "chrome/browser/views/tabs/side_tab_strip_model.h" 10 #include "chrome/browser/views/tabs/side_tab_strip_model.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "views/controls/button/button.h" 12 #include "views/controls/button/button.h"
13 #include "views/view.h" 13 #include "views/view.h"
14 14
15 class SideTab; 15 class SideTab;
16 16
17 class SideTabModel { 17 class SideTabModel {
18 public: 18 public:
19 // Returns metadata about the specified |tab|. 19 // Returns metadata about the specified |tab|.
20 virtual string16 GetTitle(SideTab* tab) const = 0; 20 virtual string16 GetTitle(SideTab* tab) const = 0;
21 virtual SkBitmap GetIcon(SideTab* tab) const = 0; 21 virtual SkBitmap GetIcon(SideTab* tab) const = 0;
22 virtual bool IsSelected(SideTab* tab) const = 0; 22 virtual bool IsSelected(SideTab* tab) const = 0;
23 23
24 // Selects the tab. 24 // Selects the tab.
25 virtual void SelectTab(SideTab* tab) = 0; 25 virtual void SelectTab(SideTab* tab) = 0;
26 26
27 // Closes the tab. 27 // Closes the tab.
28 virtual void CloseTab(SideTab* tab) = 0; 28 virtual void CloseTab(SideTab* tab) = 0;
29
30 // Shows a context menu for the tab at the specified point in screen coords.
31 virtual void ShowContextMenu(SideTab* tab, const gfx::Point& p) = 0;
29 }; 32 };
30 33
31 class SideTab : public views::View, 34 class SideTab : public views::View,
35 public views::ContextMenuController,
32 public views::ButtonListener, 36 public views::ButtonListener,
33 public AnimationDelegate { 37 public AnimationDelegate {
34 public: 38 public:
35 explicit SideTab(SideTabModel* model); 39 explicit SideTab(SideTabModel* model);
36 virtual ~SideTab(); 40 virtual ~SideTab();
37 41
38 // Sets the current network state of the tab. The tab renders different 42 // Sets the current network state of the tab. The tab renders different
39 // animations in place of the icon when different types of network activity 43 // animations in place of the icon when different types of network activity
40 // are occurring. 44 // are occurring.
41 void SetNetworkState(SideTabStripModel::NetworkState state); 45 void SetNetworkState(SideTabStripModel::NetworkState state);
42 46
43 // AnimationDelegate implementation: 47 // AnimationDelegate implementation:
44 virtual void AnimationProgressed(const Animation* animation); 48 virtual void AnimationProgressed(const Animation* animation);
45 virtual void AnimationCanceled(const Animation* animation); 49 virtual void AnimationCanceled(const Animation* animation);
46 virtual void AnimationEnded(const Animation* animation); 50 virtual void AnimationEnded(const Animation* animation);
47 51
48 // views::ButtonListener implementation: 52 // views::ButtonListener implementation:
49 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 53 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
50 54
55 // views::ContextMenuController implementation:
56 virtual void ShowContextMenu(views::View* source,
57 const gfx::Point& p,
58 bool is_mouse_gesture);
59
51 // views::View Overrides: 60 // views::View Overrides:
52 virtual void Layout(); 61 virtual void Layout();
53 virtual void Paint(gfx::Canvas* canvas); 62 virtual void Paint(gfx::Canvas* canvas);
54 virtual gfx::Size GetPreferredSize(); 63 virtual gfx::Size GetPreferredSize();
55 virtual void OnMouseEntered(const views::MouseEvent& event); 64 virtual void OnMouseEntered(const views::MouseEvent& event);
56 virtual void OnMouseExited(const views::MouseEvent& event); 65 virtual void OnMouseExited(const views::MouseEvent& event);
57 virtual bool OnMousePressed(const views::MouseEvent& event); 66 virtual bool OnMousePressed(const views::MouseEvent& event);
58 67
59 private: 68 private:
60 void FillTabShapePath(gfx::Path* path); 69 void FillTabShapePath(gfx::Path* path);
(...skipping 24 matching lines...) Expand all
85 // The current network state for this tab. 94 // The current network state for this tab.
86 SideTabStripModel::NetworkState current_state_; 95 SideTabStripModel::NetworkState current_state_;
87 96
88 // The current index into the Animation image strip. 97 // The current index into the Animation image strip.
89 int loading_animation_frame_; 98 int loading_animation_frame_;
90 99
91 DISALLOW_COPY_AND_ASSIGN(SideTab); 100 DISALLOW_COPY_AND_ASSIGN(SideTab);
92 }; 101 };
93 102
94 #endif // CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_H_ 103 #endif // CHROME_BROWSER_VIEWS_TABS_SIDE_TAB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698