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

Side by Side Diff: chrome/browser/thumbnails/thumbnailing_context.cc

Issue 1450083002: Revert "Fix NTP thumbnail generation" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove thumbnailing context unittest. 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/browser/thumbnails/thumbnailing_context.h" 5 #include "chrome/browser/thumbnails/thumbnailing_context.h"
6 6
7 #include "content/public/browser/render_view_host.h" 7 #include "content/public/browser/render_view_host.h"
8 #include "content/public/browser/render_widget_host_view.h" 8 #include "content/public/browser/render_widget_host_view.h"
9 9
10 namespace thumbnails { 10 namespace thumbnails {
11 11
12 ThumbnailingContext::ThumbnailingContext(content::WebContents* web_contents, 12 ThumbnailingContext::ThumbnailingContext(content::WebContents* web_contents,
13 ThumbnailService* receiving_service, 13 ThumbnailService* receiving_service,
14 bool load_interrupted) 14 bool load_interrupted)
15 : content::WebContentsObserver(web_contents), 15 : service(receiving_service),
16 service_(receiving_service), 16 url(web_contents->GetURL()),
17 clip_result_(CLIP_RESULT_UNPROCESSED) { 17 clip_result(CLIP_RESULT_UNPROCESSED) {
18 score_.at_top = 18 score.at_top =
19 (web_contents->GetRenderWidgetHostView()->GetLastScrollOffset().y() == 0); 19 (web_contents->GetRenderWidgetHostView()->GetLastScrollOffset().y() == 0);
20 score_.load_completed = !web_contents->IsLoading() && !load_interrupted; 20 score.load_completed = !web_contents->IsLoading() && !load_interrupted;
21 } 21 }
22 22
23 ThumbnailingContext::ThumbnailingContext() 23 ThumbnailingContext::ThumbnailingContext()
24 : content::WebContentsObserver(nullptr), 24 : clip_result(CLIP_RESULT_UNPROCESSED) {
25 clip_result_(CLIP_RESULT_UNPROCESSED) {
26 } 25 }
27 26
28 ThumbnailingContext::~ThumbnailingContext() { 27 ThumbnailingContext::~ThumbnailingContext() {
29 } 28 }
30 29
31 const scoped_refptr<ThumbnailService>& ThumbnailingContext::service() const {
32 return service_;
33 }
34
35 const GURL& ThumbnailingContext::GetURL() const {
36 return web_contents()->GetURL();
37 }
38
39 ClipResult ThumbnailingContext::clip_result() const {
40 return clip_result_;
41 }
42
43 void ThumbnailingContext::set_clip_result(ClipResult result) {
44 clip_result_ = result;
45 }
46
47 gfx::Size ThumbnailingContext::requested_copy_size() {
48 return requested_copy_size_;
49 }
50
51 void ThumbnailingContext::set_requested_copy_size(
52 const gfx::Size& requested_size) {
53 requested_copy_size_ = requested_size;
54 }
55
56 ThumbnailScore ThumbnailingContext::score() const {
57 return score_;
58 }
59
60 void ThumbnailingContext::SetBoringScore(double score) {
61 score_.boring_score = score;
62 }
63
64 void ThumbnailingContext::SetGoodClipping(bool is_good_clipping) {
65 score_.good_clipping = is_good_clipping;
66 }
67
68 } // namespace thumbnails 30 } // namespace thumbnails
OLDNEW
« no previous file with comments | « chrome/browser/thumbnails/thumbnailing_context.h ('k') | chrome/browser/thumbnails/thumbnailing_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698