Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / thumbnails / thumbnail_tab_helper.h
blob8e97064540bcdf5078b771432a25872e80fc713e
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_
6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_
8 #include "base/basictypes.h"
9 #include "chrome/browser/thumbnails/thumbnailing_context.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
12 #include "content/public/browser/readback_types.h"
13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h"
16 namespace content {
17 class RenderViewHost;
18 class RenderWidgetHost;
21 class ThumbnailTabHelper
22 : public content::NotificationObserver,
23 public content::WebContentsObserver,
24 public content::WebContentsUserData<ThumbnailTabHelper> {
25 public:
26 ~ThumbnailTabHelper() override;
28 // Enables or disables the function of taking thumbnails.
29 // A disabled ThumbnailTabHelper generates no thumbnails although it still
30 // continues to receive the notifications from the web contents.
31 void set_enabled(bool enabled) { enabled_ = enabled; }
33 private:
34 explicit ThumbnailTabHelper(content::WebContents* contents);
35 friend class content::WebContentsUserData<ThumbnailTabHelper>;
37 // content::NotificationObserver overrides.
38 void Observe(int type,
39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) override;
42 // content::WebContentsObserver overrides.
43 void RenderViewDeleted(content::RenderViewHost* render_view_host) override;
44 void DidStartLoading() override;
45 void NavigationStopped() override;
47 // Update the thumbnail of the given tab contents if necessary.
48 void UpdateThumbnailIfNecessary(content::WebContents* web_contents);
50 // Called when a render view host was created for a WebContents.
51 void RenderViewHostCreated(content::RenderViewHost* renderer);
53 // Indicates that the given widget has changed is visibility.
54 void WidgetHidden(content::RenderWidgetHost* widget);
56 bool enabled_;
58 content::NotificationRegistrar registrar_;
60 bool load_interrupted_;
62 DISALLOW_COPY_AND_ASSIGN(ThumbnailTabHelper);
65 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_TAB_HELPER_H_