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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.cc

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 | « chrome/browser/tab_contents/thumbnail_generator_unittest.cc ('k') | ui/gfx/color_utils.h » ('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 #include "chrome/renderer/chrome_render_view_observer.h" 5 #include "chrome/renderer/chrome_render_view_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 return true; 171 return true;
172 } 172 }
173 173
174 // Calculates how "boring" a thumbnail is. The boring score is the 174 // Calculates how "boring" a thumbnail is. The boring score is the
175 // 0,1 ranged percentage of pixels that are the most common 175 // 0,1 ranged percentage of pixels that are the most common
176 // luma. Higher boring scores indicate that a higher percentage of a 176 // luma. Higher boring scores indicate that a higher percentage of a
177 // bitmap are all the same brightness. 177 // bitmap are all the same brightness.
178 static double CalculateBoringScore(SkBitmap* bitmap) { 178 static double CalculateBoringScore(SkBitmap* bitmap) {
179 int histogram[256] = {0}; 179 int histogram[256] = {0};
180 color_utils::BuildLumaHistogram(bitmap, histogram); 180 color_utils::BuildLumaHistogram(*bitmap, histogram);
181 181
182 int color_count = *std::max_element(histogram, histogram + 256); 182 int color_count = *std::max_element(histogram, histogram + 256);
183 int pixel_count = bitmap->width() * bitmap->height(); 183 int pixel_count = bitmap->width() * bitmap->height();
184 return static_cast<double>(color_count) / pixel_count; 184 return static_cast<double>(color_count) / pixel_count;
185 } 185 }
186 186
187 static FaviconURL::IconType ToFaviconType(WebIconURL::Type type) { 187 static FaviconURL::IconType ToFaviconType(WebIconURL::Type type) {
188 switch (type) { 188 switch (type) {
189 case WebIconURL::TypeFavicon: 189 case WebIconURL::TypeFavicon:
190 return FaviconURL::FAVICON; 190 return FaviconURL::FAVICON;
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 reinterpret_cast<const unsigned char*>(&data[0]); 1049 reinterpret_cast<const unsigned char*>(&data[0]);
1050 1050
1051 return decoder.Decode(src_data, data.size()); 1051 return decoder.Decode(src_data, data.size());
1052 } 1052 }
1053 return SkBitmap(); 1053 return SkBitmap();
1054 } 1054 }
1055 1055
1056 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) { 1056 bool ChromeRenderViewObserver::IsStrictSecurityHost(const std::string& host) {
1057 return (strict_security_hosts_.find(host) != strict_security_hosts_.end()); 1057 return (strict_security_hosts_.find(host) != strict_security_hosts_.end());
1058 } 1058 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/thumbnail_generator_unittest.cc ('k') | ui/gfx/color_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698