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

Side by Side Diff: content/browser/frame_host/navigation_entry_screenshot_manager.cc

Issue 291003002: Move OverscrollController to RenderWidgetHostViewAura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK_GE Created 6 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/browser/frame_host/navigation_entry_screenshot_manager.h" 5 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/threading/worker_pool.h" 8 #include "base/threading/worker_pool.h"
9 #include "content/browser/frame_host/navigation_controller_impl.h" 9 #include "content/browser/frame_host/navigation_controller_impl.h"
10 #include "content/browser/frame_host/navigation_entry_impl.h" 10 #include "content/browser/frame_host/navigation_entry_impl.h"
11 #include "content/browser/renderer_host/render_view_host_impl.h" 11 #include "content/browser/renderer_host/render_view_host_impl.h"
12 #include "content/public/browser/overscroll_configuration.h"
12 #include "content/public/browser/render_widget_host.h" 13 #include "content/public/browser/render_widget_host.h"
13 #include "content/public/browser/render_widget_host_view.h" 14 #include "content/public/browser/render_widget_host_view.h"
14 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
15 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
16 #include "third_party/skia/include/core/SkPaint.h" 17 #include "third_party/skia/include/core/SkPaint.h"
17 #include "third_party/skia/include/effects/SkLumaColorFilter.h" 18 #include "third_party/skia/include/effects/SkLumaColorFilter.h"
18 #include "ui/gfx/codec/png_codec.h" 19 #include "ui/gfx/codec/png_codec.h"
19 20
20 namespace { 21 namespace {
21 22
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 static bool overscroll_enabled = CommandLine::ForCurrentProcess()-> 90 static bool overscroll_enabled = CommandLine::ForCurrentProcess()->
90 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 91 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
91 if (!overscroll_enabled) 92 if (!overscroll_enabled)
92 return; 93 return;
93 94
94 NavigationEntryImpl* entry = 95 NavigationEntryImpl* entry =
95 NavigationEntryImpl::FromNavigationEntry(owner_->GetLastCommittedEntry()); 96 NavigationEntryImpl::FromNavigationEntry(owner_->GetLastCommittedEntry());
96 if (!entry) 97 if (!entry)
97 return; 98 return;
98 99
100 if (!owner_->delegate()->CanOverscrollContent())
101 return;
102
99 RenderViewHost* render_view_host = 103 RenderViewHost* render_view_host =
100 owner_->delegate()->GetRenderViewHost(); 104 owner_->delegate()->GetRenderViewHost();
101 if (!static_cast<RenderViewHostImpl*>
102 (render_view_host)->overscroll_controller()) {
103 return;
104 }
105 content::RenderWidgetHostView* view = render_view_host->GetView(); 105 content::RenderWidgetHostView* view = render_view_host->GetView();
106 if (!view) 106 if (!view)
107 return; 107 return;
108 108
109 // Make sure screenshots aren't taken too frequently. 109 // Make sure screenshots aren't taken too frequently.
110 base::Time now = base::Time::Now(); 110 base::Time now = base::Time::Now();
111 if (now - last_screenshot_time_ < 111 if (now - last_screenshot_time_ <
112 base::TimeDelta::FromMilliseconds(min_screenshot_interval_ms_)) { 112 base::TimeDelta::FromMilliseconds(min_screenshot_interval_ms_)) {
113 return; 113 return;
114 } 114 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 owner_->GetEntryAtIndex(forward)); 287 owner_->GetEntryAtIndex(forward));
288 if (ClearScreenshot(entry)) 288 if (ClearScreenshot(entry))
289 --screenshot_count; 289 --screenshot_count;
290 ++forward; 290 ++forward;
291 } 291 }
292 CHECK_GE(screenshot_count, 0); 292 CHECK_GE(screenshot_count, 0);
293 CHECK_LE(screenshot_count, kMaxScreenshots); 293 CHECK_LE(screenshot_count, kMaxScreenshots);
294 } 294 }
295 295
296 } // namespace content 296 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_delegate.h ('k') | content/browser/frame_host/navigator_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698