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

Side by Side Diff: chrome/browser/tab_contents/thumbnail_generator.h

Issue 10348007: Remove some dead code in ThumbnailGenerator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/tab_contents/thumbnail_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_TAB_CONTENTS_THUMBNAIL_GENERATOR_H_ 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_THUMBNAIL_GENERATOR_H_
6 #define CHROME_BROWSER_TAB_CONTENTS_THUMBNAIL_GENERATOR_H_ 6 #define CHROME_BROWSER_TAB_CONTENTS_THUMBNAIL_GENERATOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 // Starts taking thumbnails of the given tab contents. 73 // Starts taking thumbnails of the given tab contents.
74 void StartThumbnailing(content::WebContents* web_contents); 74 void StartThumbnailing(content::WebContents* web_contents);
75 75
76 // Enables or disables the function of taking thumbnails. 76 // Enables or disables the function of taking thumbnails.
77 // A disabled ThumbnailGenerator generates no thumbnails although it still 77 // A disabled ThumbnailGenerator generates no thumbnails although it still
78 // continues to receive the notifications from the web contents. 78 // continues to receive the notifications from the web contents.
79 void set_enabled(bool enabled) { enabled_ = enabled; } 79 void set_enabled(bool enabled) { enabled_ = enabled; }
80 80
81 // This registers a callback that can receive the resulting SkBitmap 81 // This registers a callback that can receive the resulting SkBitmap
82 // from the renderer when it is done rendering it. This differs 82 // from the renderer when it is done rendering it. This is asynchronous,
83 // from GetThumbnailForRenderer in that it may be asynchronous, and 83 // and it will also fetch the bitmap even if the tab is hidden.
84 // because it will also fetch the bitmap even if the tab is hidden.
85 // In addition, if the renderer has to be invoked, the scaling of 84 // In addition, if the renderer has to be invoked, the scaling of
86 // the thumbnail happens on the rendering thread. 85 // the thumbnail happens on the rendering thread.
87 // 86 //
88 // Takes ownership of the callback object. 87 // Takes ownership of the callback object.
89 // 88 //
90 // If |prefer_backing_store| is set, then the function will try and 89 // |page_size| is the size to render the page, and |desired_size| is
91 // use the backing store for the page if it exists. |page_size| is 90 // the size to scale the resulting rendered page to (which is done
92 // the size to render the page, and |desired_size| is the size to 91 // efficiently if done in the rendering thread). The resulting image
93 // scale the resulting rendered page to (which is done efficiently 92 // will be less then twice the size of the |desired_size| in both
94 // if done in the rendering thread). If |prefer_backing_store| is
95 // set, and the backing store is used, then the resulting image will
96 // be less then twice the size of the |desired_size| in both
97 // dimensions, but might not be the exact size requested. 93 // dimensions, but might not be the exact size requested.
98 void AskForSnapshot(content::RenderWidgetHost* renderer, 94 void AskForSnapshot(content::RenderWidgetHost* renderer,
99 bool prefer_backing_store,
100 const ThumbnailReadyCallback& callback, 95 const ThumbnailReadyCallback& callback,
101 gfx::Size page_size, 96 gfx::Size page_size,
102 gfx::Size desired_size); 97 gfx::Size desired_size);
103 98
104 // This returns a thumbnail of a fixed, small size for the given
105 // renderer.
106 SkBitmap GetThumbnailForRenderer(content::RenderWidgetHost* renderer) const;
107
108 // This returns a thumbnail of a fixed, small size for the given
109 // renderer. |options| is a bitmask of ThumbnailOptions. If
110 // |clip_result| is non-NULL, the result of clipping will be written.
111 SkBitmap GetThumbnailForRendererWithOptions(
112 content::RenderWidgetHost* renderer,
113 int options,
114 ClipResult* clip_result) const;
115
116 // Start or stop monitoring notifications for |renderer| based on the value 99 // Start or stop monitoring notifications for |renderer| based on the value
117 // of |monitor|. 100 // of |monitor|.
118 void MonitorRenderer(content::RenderWidgetHost* renderer, bool monitor); 101 void MonitorRenderer(content::RenderWidgetHost* renderer, bool monitor);
119 102
120 // Calculates how "boring" a thumbnail is. The boring score is the 103 // Calculates how "boring" a thumbnail is. The boring score is the
121 // 0,1 ranged percentage of pixels that are the most common 104 // 0,1 ranged percentage of pixels that are the most common
122 // luma. Higher boring scores indicate that a higher percentage of a 105 // luma. Higher boring scores indicate that a higher percentage of a
123 // bitmap are all the same brightness. 106 // bitmap are all the same brightness.
124 static double CalculateBoringScore(const SkBitmap& bitmap); 107 static double CalculateBoringScore(const SkBitmap& bitmap);
125 108
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 bool load_interrupted_; 174 bool load_interrupted_;
192 175
193 base::WeakPtrFactory<ThumbnailGenerator> weak_factory_; 176 base::WeakPtrFactory<ThumbnailGenerator> weak_factory_;
194 scoped_ptr<base::WeakPtrFactory<content::WebContents> > 177 scoped_ptr<base::WeakPtrFactory<content::WebContents> >
195 web_contents_weak_factory_; 178 web_contents_weak_factory_;
196 179
197 DISALLOW_COPY_AND_ASSIGN(ThumbnailGenerator); 180 DISALLOW_COPY_AND_ASSIGN(ThumbnailGenerator);
198 }; 181 };
199 182
200 #endif // CHROME_BROWSER_TAB_CONTENTS_THUMBNAIL_GENERATOR_H_ 183 #endif // CHROME_BROWSER_TAB_CONTENTS_THUMBNAIL_GENERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/tab_contents/thumbnail_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698