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

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

Issue 1461463002: Reland fix for thumbnail generation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rework how ignore spurrious thumbnail generation requests. 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(
13 ThumbnailService* receiving_service, 13 content::WebContents* web_contents,
14 bool load_interrupted) 14 ThumbnailService* receiving_service,
15 : service(receiving_service), 15 base::WeakPtr<ThumbnailTabHelper> source_tab_helper,
16 url(web_contents->GetURL()), 16 bool load_interrupted)
17 clip_result(CLIP_RESULT_UNPROCESSED) { 17 : content::WebContentsObserver(web_contents),
18 score.at_top = 18 service_(receiving_service),
19 clip_result_(CLIP_RESULT_UNPROCESSED),
20 source_tab_helper_(source_tab_helper) {
21
22 score_.at_top =
19 (web_contents->GetRenderWidgetHostView()->GetLastScrollOffset().y() == 0); 23 (web_contents->GetRenderWidgetHostView()->GetLastScrollOffset().y() == 0);
20 score.load_completed = !web_contents->IsLoading() && !load_interrupted; 24 score_.load_completed = !web_contents->IsLoading() && !load_interrupted;
21 } 25 }
22 26
23 ThumbnailingContext::ThumbnailingContext() 27 ThumbnailingContext::ThumbnailingContext()
24 : clip_result(CLIP_RESULT_UNPROCESSED) { 28 : content::WebContentsObserver(nullptr),
29 service_(nullptr),
30 clip_result_(CLIP_RESULT_UNPROCESSED),
31 source_tab_helper_(base::WeakPtr<ThumbnailTabHelper>()) {
25 } 32 }
26 33
27 ThumbnailingContext::~ThumbnailingContext() { 34 ThumbnailingContext::~ThumbnailingContext() {
28 } 35 }
29 36
37 const scoped_refptr<ThumbnailService>& ThumbnailingContext::service() const {
38 return service_;
39 }
40
41 const GURL& ThumbnailingContext::GetURL() const {
42 return web_contents()->GetURL();
43 }
44
45 ClipResult ThumbnailingContext::clip_result() const {
46 return clip_result_;
47 }
48
49 void ThumbnailingContext::set_clip_result(ClipResult result) {
50 clip_result_ = result;
51 }
52
53 gfx::Size ThumbnailingContext::requested_copy_size() {
54 return requested_copy_size_;
55 }
56
57 void ThumbnailingContext::set_requested_copy_size(
58 const gfx::Size& requested_size) {
59 requested_copy_size_ = requested_size;
60 }
61
62 ThumbnailScore ThumbnailingContext::score() const {
63 return score_;
64 }
65
66 void ThumbnailingContext::SetBoringScore(double score) {
67 score_.boring_score = score;
68 }
69
70 void ThumbnailingContext::SetGoodClipping(bool is_good_clipping) {
71 score_.good_clipping = is_good_clipping;
72 }
73
30 } // namespace thumbnails 74 } // namespace thumbnails
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698