OLD | NEW |
---|---|
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 : service(receiving_service), | 15 : content::WebContentsObserver(web_contents), |
16 url(web_contents->GetURL()), | 16 service_(receiving_service), |
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 : clip_result(CLIP_RESULT_UNPROCESSED) { | 24 : clip_result_(CLIP_RESULT_UNPROCESSED) { |
25 } | 25 } |
26 | 26 |
27 ThumbnailingContext::~ThumbnailingContext() { | 27 ThumbnailingContext::~ThumbnailingContext() { |
28 } | 28 } |
29 | 29 |
30 const scoped_refptr<ThumbnailService>& ThumbnailingContext::service() const { | |
31 return service_; | |
32 } | |
33 | |
34 const GURL& ThumbnailingContext::GetURL() const { | |
35 return web_contents()->GetURL(); | |
36 } | |
37 | |
38 ClipResult ThumbnailingContext::clip_result() const { | |
39 return clip_result_; | |
40 } | |
41 | |
42 void ThumbnailingContext::set_clip_result(ClipResult result) { | |
43 clip_result_ = result; | |
44 } | |
45 | |
46 gfx::Size ThumbnailingContext::requested_copy_size() { | |
47 return requested_copy_size_; | |
48 } | |
49 | |
50 void ThumbnailingContext::set_requested_copy_size(const gfx::Size& | |
51 requested_size) { | |
Lei Zhang
2015/11/03 18:59:25
nit: not a good spot for a line break.
void Thumb
shrike
2015/11/03 19:10:49
Acknowledged.
| |
52 requested_copy_size_ = requested_size; | |
53 } | |
54 | |
55 ThumbnailScore ThumbnailingContext::score() const { | |
56 return score_; | |
57 } | |
58 | |
59 void ThumbnailingContext::SetBoringScore(double score) { | |
60 score_.boring_score = score; | |
61 } | |
62 | |
63 void ThumbnailingContext::SetGoodClipping(bool is_good_clipping) { | |
64 score_.good_clipping = is_good_clipping; | |
65 } | |
66 | |
30 } // namespace thumbnails | 67 } // namespace thumbnails |
OLD | NEW |