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

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

Issue 9662021: Fixed pass-by-value to pass-by-reference (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed unit test compile errors Created 8 years, 9 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 ClipResult* clip_result) const; 102 ClipResult* clip_result) const;
103 103
104 // Start or stop monitoring notifications for |renderer| based on the value 104 // Start or stop monitoring notifications for |renderer| based on the value
105 // of |monitor|. 105 // of |monitor|.
106 void MonitorRenderer(content::RenderWidgetHost* renderer, bool monitor); 106 void MonitorRenderer(content::RenderWidgetHost* renderer, bool monitor);
107 107
108 // Calculates how "boring" a thumbnail is. The boring score is the 108 // Calculates how "boring" a thumbnail is. The boring score is the
109 // 0,1 ranged percentage of pixels that are the most common 109 // 0,1 ranged percentage of pixels that are the most common
110 // luma. Higher boring scores indicate that a higher percentage of a 110 // luma. Higher boring scores indicate that a higher percentage of a
111 // bitmap are all the same brightness. 111 // bitmap are all the same brightness.
112 static double CalculateBoringScore(SkBitmap* bitmap); 112 static double CalculateBoringScore(const SkBitmap& bitmap);
113 113
114 // Gets the clipped bitmap from |bitmap| per the aspect ratio of the 114 // Gets the clipped bitmap from |bitmap| per the aspect ratio of the
115 // desired width and the desired height. For instance, if the input 115 // desired width and the desired height. For instance, if the input
116 // bitmap is vertically long (ex. 400x900) and the desired size is 116 // bitmap is vertically long (ex. 400x900) and the desired size is
117 // square (ex. 100x100), the clipped bitmap will be the top half of the 117 // square (ex. 100x100), the clipped bitmap will be the top half of the
118 // input bitmap (400x400). 118 // input bitmap (400x400).
119 static SkBitmap GetClippedBitmap(const SkBitmap& bitmap, 119 static SkBitmap GetClippedBitmap(const SkBitmap& bitmap,
120 int desired_width, 120 int desired_width,
121 int desired_height, 121 int desired_height,
122 ClipResult* clip_result); 122 ClipResult* clip_result);
123 123
124 // Update the thumbnail of the given tab contents if necessary. 124 // Update the thumbnail of the given tab contents if necessary.
125 void UpdateThumbnailIfNecessary(content::WebContents* webb_contents); 125 void UpdateThumbnailIfNecessary(content::WebContents* webb_contents);
126 126
127 // Update the thumbnail of the given tab. 127 // Update the thumbnail of the given tab.
128 void UpdateThumbnail(content::WebContents* web_contents, SkBitmap bitmap, 128 void UpdateThumbnail(content::WebContents* web_contents,
129 const ThumbnailGenerator::ClipResult& clip_result); 129 const SkBitmap& bitmap,
130 const ThumbnailGenerator::ClipResult& clip_result);
130 131
131 // Returns true if we should update the thumbnail of the given URL. 132 // Returns true if we should update the thumbnail of the given URL.
132 static bool ShouldUpdateThumbnail(Profile* profile, 133 static bool ShouldUpdateThumbnail(Profile* profile,
133 history::TopSites* top_sites, 134 history::TopSites* top_sites,
134 const GURL& url); 135 const GURL& url);
135 136
136 // content::WebContentsObserver overrides. 137 // content::WebContentsObserver overrides.
137 virtual void DidStartLoading() OVERRIDE; 138 virtual void DidStartLoading() OVERRIDE;
138 virtual void StopNavigation() OVERRIDE; 139 virtual void StopNavigation() OVERRIDE;
139 140
(...skipping 22 matching lines...) Expand all
162 typedef std::map<int, 163 typedef std::map<int,
163 linked_ptr<AsyncRequestInfo> > ThumbnailCallbackMap; 164 linked_ptr<AsyncRequestInfo> > ThumbnailCallbackMap;
164 ThumbnailCallbackMap callback_map_; 165 ThumbnailCallbackMap callback_map_;
165 166
166 bool load_interrupted_; 167 bool load_interrupted_;
167 168
168 DISALLOW_COPY_AND_ASSIGN(ThumbnailGenerator); 169 DISALLOW_COPY_AND_ASSIGN(ThumbnailGenerator);
169 }; 170 };
170 171
171 #endif // CHROME_BROWSER_TAB_CONTENTS_THUMBNAIL_GENERATOR_H_ 172 #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