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

Side by Side Diff: chrome/browser/thumbnails/thumbnail_tab_helper.h

Issue 1461463002: Reland fix for thumbnail generation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rework how ignore spurrious thumbnail generation requests. Created 5 years, 1 month 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_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_
6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/thumbnails/thumbnailing_context.h" 10 #include "chrome/browser/thumbnails/thumbnailing_context.h"
10 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
12 #include "content/public/browser/readback_types.h" 13 #include "content/public/browser/readback_types.h"
13 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h" 15 #include "content/public/browser/web_contents_user_data.h"
15 16
16 namespace content { 17 namespace content {
17 class RenderViewHost; 18 class RenderViewHost;
18 class RenderWidgetHost; 19 class RenderWidgetHost;
19 } 20 }
20 21
21 class ThumbnailTabHelper 22 class ThumbnailTabHelper
22 : public content::NotificationObserver, 23 : public content::NotificationObserver,
23 public content::WebContentsObserver, 24 public content::WebContentsObserver,
24 public content::WebContentsUserData<ThumbnailTabHelper> { 25 public content::WebContentsUserData<ThumbnailTabHelper> {
25 public: 26 public:
26 ~ThumbnailTabHelper() override; 27 ~ThumbnailTabHelper() override;
27 28
29 void set_thumbnail_generation_in_progress(bool flag);
30
28 private: 31 private:
29 explicit ThumbnailTabHelper(content::WebContents* contents); 32 explicit ThumbnailTabHelper(content::WebContents* contents);
30 friend class content::WebContentsUserData<ThumbnailTabHelper>; 33 friend class content::WebContentsUserData<ThumbnailTabHelper>;
31 34
32 // content::NotificationObserver overrides. 35 // content::NotificationObserver overrides.
33 void Observe(int type, 36 void Observe(int type,
34 const content::NotificationSource& source, 37 const content::NotificationSource& source,
35 const content::NotificationDetails& details) override; 38 const content::NotificationDetails& details) override;
36 39
37 // content::WebContentsObserver overrides. 40 // content::WebContentsObserver overrides.
38 void RenderViewDeleted(content::RenderViewHost* render_view_host) override; 41 void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
39 void DidStartLoading() override; 42 void DidStartLoading() override;
40 void NavigationStopped() override; 43 void NavigationStopped() override;
41 44
42 // Update the thumbnail of the given tab contents if necessary. 45 // Update the thumbnail of the given tab contents if necessary.
43 void UpdateThumbnailIfNecessary(content::WebContents* web_contents); 46 void UpdateThumbnailIfNecessary(content::WebContents* web_contents);
44 47
45 // Called when a render view host was created for a WebContents. 48 // Called when a render view host was created for a WebContents.
46 void RenderViewHostCreated(content::RenderViewHost* renderer); 49 void RenderViewHostCreated(content::RenderViewHost* renderer);
47 50
48 // Indicates that the given widget has changed is visibility. 51 // Indicates that the given widget has changed is visibility.
49 void WidgetHidden(content::RenderWidgetHost* widget); 52 void WidgetHidden(content::RenderWidgetHost* widget);
50 53
51 content::NotificationRegistrar registrar_; 54 content::NotificationRegistrar registrar_;
52 55
53 bool load_interrupted_; 56 bool load_interrupted_;
57 bool thumbnail_generation_in_progress_;
58
59 base::WeakPtrFactory<ThumbnailTabHelper> weak_factory_;
54 60
55 DISALLOW_COPY_AND_ASSIGN(ThumbnailTabHelper); 61 DISALLOW_COPY_AND_ASSIGN(ThumbnailTabHelper);
56 }; 62 };
57 63
58 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_ 64 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698