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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_ 7 #pragma once 8 9 #include "base/process_util.h" 10 #include "base/string16.h" 11 #include "googleurl/src/gurl.h" 12 #include "third_party/skia/include/core/SkBitmap.h" 13 14 // Wraps the state needed by the renderers. 15 struct TabRendererData { 16 // Different types of network activity for a tab. The NetworkState of a tab 17 // may be used to alter the UI (e.g. show different kinds of loading 18 // animations). 19 enum NetworkState { 20 NETWORK_STATE_NONE, // no network activity. 21 NETWORK_STATE_WAITING, // waiting for a connection. 22 NETWORK_STATE_LOADING, // connected, transferring data. 23 }; 24 25 TabRendererData(); 26 ~TabRendererData(); 27 28 // This interprets the crashed status to decide whether or not this 29 // render data represents a tab that is "crashed" (i.e. the render 30 // process died unexpectedly). 31 bool IsCrashed() const { 32 return (crashed_status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || 33 crashed_status == base::TERMINATION_STATUS_PROCESS_CRASHED || 34 crashed_status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION); 35 } 36 37 // Returns true if the TabRendererData is same as given |data|. Two favicons 38 // are considered equals if two SkBitmaps point to the same SkPixelRef object. 39 bool Equals(const TabRendererData& data); 40 41 SkBitmap favicon; 42 NetworkState network_state; 43 string16 title; 44 GURL url; 45 bool loading; 46 base::TerminationStatus crashed_status; 47 bool incognito; 48 bool show_icon; 49 bool mini; 50 bool blocked; 51 bool app; 52 }; 53 54 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_RENDERER_DATA_H_ 55