OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEWS_TABS_TAB_RENDERER_DATA_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_ |
7 | 7 |
8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "chrome/browser/ui/search/search_types.h" | 10 #include "chrome/browser/ui/search/search_types.h" |
11 #include "chrome/browser/ui/search/toolbar_search_animator.h" | 11 #include "chrome/browser/ui/search/toolbar_search_animator.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "ui/gfx/image/image_skia.h" |
14 | 14 |
15 // Wraps the state needed by the renderers. | 15 // Wraps the state needed by the renderers. |
16 struct TabRendererData { | 16 struct TabRendererData { |
17 // Different types of network activity for a tab. The NetworkState of a tab | 17 // Different types of network activity for a tab. The NetworkState of a tab |
18 // may be used to alter the UI (e.g. show different kinds of loading | 18 // may be used to alter the UI (e.g. show different kinds of loading |
19 // animations). | 19 // animations). |
20 enum NetworkState { | 20 enum NetworkState { |
21 NETWORK_STATE_NONE, // no network activity. | 21 NETWORK_STATE_NONE, // no network activity. |
22 NETWORK_STATE_WAITING, // waiting for a connection. | 22 NETWORK_STATE_WAITING, // waiting for a connection. |
23 NETWORK_STATE_LOADING, // connected, transferring data. | 23 NETWORK_STATE_LOADING, // connected, transferring data. |
24 }; | 24 }; |
25 | 25 |
26 TabRendererData(); | 26 TabRendererData(); |
27 ~TabRendererData(); | 27 ~TabRendererData(); |
28 | 28 |
29 // This interprets the crashed status to decide whether or not this | 29 // This interprets the crashed status to decide whether or not this |
30 // render data represents a tab that is "crashed" (i.e. the render | 30 // render data represents a tab that is "crashed" (i.e. the render |
31 // process died unexpectedly). | 31 // process died unexpectedly). |
32 bool IsCrashed() const { | 32 bool IsCrashed() const { |
33 return (crashed_status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || | 33 return (crashed_status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || |
34 crashed_status == base::TERMINATION_STATUS_PROCESS_CRASHED || | 34 crashed_status == base::TERMINATION_STATUS_PROCESS_CRASHED || |
35 crashed_status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION); | 35 crashed_status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION); |
36 } | 36 } |
37 | 37 |
38 // Returns true if the TabRendererData is same as given |data|. Two favicons | 38 // Returns true if the TabRendererData is same as given |data|. |
39 // are considered equals if two SkBitmaps point to the same SkPixelRef object. | |
40 bool Equals(const TabRendererData& data); | 39 bool Equals(const TabRendererData& data); |
41 | 40 |
42 SkBitmap favicon; | 41 gfx::ImageSkia favicon; |
43 NetworkState network_state; | 42 NetworkState network_state; |
44 string16 title; | 43 string16 title; |
45 GURL url; | 44 GURL url; |
46 bool loading; | 45 bool loading; |
47 base::TerminationStatus crashed_status; | 46 base::TerminationStatus crashed_status; |
48 bool incognito; | 47 bool incognito; |
49 bool show_icon; | 48 bool show_icon; |
50 bool mini; | 49 bool mini; |
51 bool blocked; | 50 bool blocked; |
52 bool app; | 51 bool app; |
53 chrome::search::Mode::Type mode; | 52 chrome::search::Mode::Type mode; |
54 // Only applicable if |mode| is chrome::search::Mode::SEARCH. | 53 // Only applicable if |mode| is chrome::search::Mode::SEARCH. |
55 chrome::search::ToolbarSearchAnimator::BackgroundState background_state; | 54 chrome::search::ToolbarSearchAnimator::BackgroundState background_state; |
56 // Only applicable if |background_state| is or a combination including | 55 // Only applicable if |background_state| is or a combination including |
57 // chrome::search::ToolbarSearchAnimator::BACKGROUND_STATE_SHOW_NEW; | 56 // chrome::search::ToolbarSearchAnimator::BACKGROUND_STATE_SHOW_NEW; |
58 double search_background_opacity; | 57 double search_background_opacity; |
59 }; | 58 }; |
60 | 59 |
61 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_ | 60 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_ |
OLD | NEW |