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

Side by Side Diff: chrome/browser/android/tab_android.h

Issue 262543002: android: add ThumbnailCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@codec
Patch Set: renamed ThumbnailCacheCore to ThumbnailCache Created 6 years, 7 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
OLDNEW
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_ANDROID_TAB_ANDROID_H_ 5 #ifndef CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
6 #define CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ 6 #define CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/jni_weak_ref.h" 10 #include "base/android/jni_weak_ref.h"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "chrome/browser/android/tab_thumbnail_provider.h"
14 #include "chrome/browser/sessions/session_id.h" 15 #include "chrome/browser/sessions/session_id.h"
15 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" 16 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
16 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" 17 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
17 #include "chrome/browser/ui/toolbar/toolbar_model.h" 18 #include "chrome/browser/ui/toolbar/toolbar_model.h"
18 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
20 21
21 class GURL; 22 class GURL;
22 class Profile; 23 class Profile;
23 class SkBitmap; 24 class SkBitmap;
(...skipping 11 matching lines...) Expand all
35 namespace content { 36 namespace content {
36 class ContentViewCore; 37 class ContentViewCore;
37 class WebContents; 38 class WebContents;
38 } 39 }
39 40
40 namespace prerender { 41 namespace prerender {
41 class PrerenderManager; 42 class PrerenderManager;
42 } 43 }
43 44
44 class TabAndroid : public CoreTabHelperDelegate, 45 class TabAndroid : public CoreTabHelperDelegate,
45 public content::NotificationObserver { 46 public content::NotificationObserver,
47 public TabThumbnailProvider {
46 public: 48 public:
47 enum TabLoadStatus { 49 enum TabLoadStatus {
48 #define DEFINE_TAB_LOAD_STATUS(name, value) name = value, 50 #define DEFINE_TAB_LOAD_STATUS(name, value) name = value,
49 #include "chrome/browser/android/tab_load_status.h" 51 #include "chrome/browser/android/tab_load_status.h"
50 #undef DEFINE_TAB_LOAD_STATUS 52 #undef DEFINE_TAB_LOAD_STATUS
51 }; 53 };
52 54
53 // Convenience method to retrieve the Tab associated with the passed 55 // Convenience method to retrieve the Tab associated with the passed
54 // WebContents. Can return NULL. 56 // WebContents. Can return NULL.
55 static TabAndroid* FromWebContents(content::WebContents* web_contents); 57 static TabAndroid* FromWebContents(content::WebContents* web_contents);
56 58
57 // Returns the native TabAndroid stored in the Java Tab represented by 59 // Returns the native TabAndroid stored in the Java Tab represented by
58 // |obj|. 60 // |obj|.
59 static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj); 61 static TabAndroid* GetNativeTab(JNIEnv* env, jobject obj);
60 62
61 // Function to attach helpers to the contentView. 63 // Function to attach helpers to the contentView.
62 static void AttachTabHelpers(content::WebContents* web_contents); 64 static void AttachTabHelpers(content::WebContents* web_contents);
63 65
64 TabAndroid(JNIEnv* env, jobject obj); 66 TabAndroid(JNIEnv* env, jobject obj);
65 virtual ~TabAndroid(); 67 virtual ~TabAndroid();
66 68
67 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); 69 base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
68 70
69 // Return the WebContents, if any, currently owned by this TabAndroid. 71 // Return the WebContents, if any, currently owned by this TabAndroid.
70 content::WebContents* web_contents() const { return web_contents_.get(); } 72 content::WebContents* web_contents() const { return web_contents_.get(); }
71 73
72 // Return specific id information regarding this TabAndroid. 74 // Return specific id information regarding this TabAndroid.
73 const SessionID& session_id() const { return session_tab_id_; } 75 const SessionID& session_id() const { return session_tab_id_; }
74 int GetAndroidId() const; 76
75 int GetSyncId() const; 77 int GetSyncId() const;
76 78
77 // Return the tab title. 79 // Return the tab title.
78 base::string16 GetTitle() const; 80 base::string16 GetTitle() const;
79 81
80 // Return the tab url.
81 GURL GetURL() const;
82
83 // Load the tab if it was unloaded from memory. 82 // Load the tab if it was unloaded from memory.
84 bool LoadIfNeeded(); 83 bool LoadIfNeeded();
85 84
86 // Helper methods to make it easier to access objects from the associated 85 // Helper methods to make it easier to access objects from the associated
87 // WebContents. Can return NULL. 86 // WebContents. Can return NULL.
88 content::ContentViewCore* GetContentViewCore() const;
89 Profile* GetProfile() const; 87 Profile* GetProfile() const;
90 browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() const; 88 browser_sync::SyncedTabDelegate* GetSyncedTabDelegate() const;
91 89
92 void SetWindowSessionID(SessionID::id_type window_id); 90 void SetWindowSessionID(SessionID::id_type window_id);
93 void SetSyncId(int sync_id); 91 void SetSyncId(int sync_id);
94 92
95 virtual void HandlePopupNavigation(chrome::NavigateParams* params); 93 virtual void HandlePopupNavigation(chrome::NavigateParams* params);
96 94
97 virtual void OnReceivedHttpAuthRequest(jobject auth_handler, 95 virtual void OnReceivedHttpAuthRequest(jobject auth_handler,
98 const base::string16& host, 96 const base::string16& host,
99 const base::string16& realm); 97 const base::string16& realm);
100 98
101 // Called to determine if chrome://welcome should contain links to the terms 99 // Called to determine if chrome://welcome should contain links to the terms
102 // of service and the privacy notice. 100 // of service and the privacy notice.
103 virtual bool ShouldWelcomePageLinkToTermsOfService(); 101 virtual bool ShouldWelcomePageLinkToTermsOfService();
104 102
105 bool HasPrerenderedUrl(GURL gurl); 103 bool HasPrerenderedUrl(GURL gurl);
106 104
105 // TabThumbnailProvider -----------------------------------------------------
106 // The unique Id associated with the Android-side of this tab.
107 virtual int GetAndroidId() const OVERRIDE;
108 // Return the tab url.
109 virtual GURL GetURL() const OVERRIDE;
110 virtual content::ContentViewCore* GetContentViewCore() const OVERRIDE;
111
107 // CoreTabHelperDelegate ---------------------------------------------------- 112 // CoreTabHelperDelegate ----------------------------------------------------
108 113
109 virtual void SwapTabContents(content::WebContents* old_contents, 114 virtual void SwapTabContents(content::WebContents* old_contents,
110 content::WebContents* new_contents, 115 content::WebContents* new_contents,
111 bool did_start_load, 116 bool did_start_load,
112 bool did_finish_load) OVERRIDE; 117 bool did_finish_load) OVERRIDE;
113 118
114 // NotificationObserver ----------------------------------------------------- 119 // NotificationObserver -----------------------------------------------------
115 virtual void Observe(int type, 120 virtual void Observe(int type,
116 const content::NotificationSource& source, 121 const content::NotificationSource& source,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 scoped_ptr<content::WebContents> web_contents_; 171 scoped_ptr<content::WebContents> web_contents_;
167 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid> 172 scoped_ptr<chrome::android::ChromeWebContentsDelegateAndroid>
168 web_contents_delegate_; 173 web_contents_delegate_;
169 174
170 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_; 175 scoped_ptr<browser_sync::SyncedTabDelegateAndroid> synced_tab_delegate_;
171 176
172 DISALLOW_COPY_AND_ASSIGN(TabAndroid); 177 DISALLOW_COPY_AND_ASSIGN(TabAndroid);
173 }; 178 };
174 179
175 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_ 180 #endif // CHROME_BROWSER_ANDROID_TAB_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698