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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 949473002: Avoid unnecessary casts in NavigationControllerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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 (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 "content/browser/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // destroyed. 119 // destroyed.
120 class OverscrollWindowDelegate : public aura_extra::ImageWindowDelegate { 120 class OverscrollWindowDelegate : public aura_extra::ImageWindowDelegate {
121 public: 121 public:
122 OverscrollWindowDelegate(WebContentsImpl* web_contents, 122 OverscrollWindowDelegate(WebContentsImpl* web_contents,
123 OverscrollMode overscroll_mode) 123 OverscrollMode overscroll_mode)
124 : web_contents_(web_contents), 124 : web_contents_(web_contents),
125 forward_events_(true) { 125 forward_events_(true) {
126 const NavigationControllerImpl& controller = web_contents->GetController(); 126 const NavigationControllerImpl& controller = web_contents->GetController();
127 const NavigationEntryImpl* entry = NULL; 127 const NavigationEntryImpl* entry = NULL;
128 if (ShouldNavigateForward(controller, overscroll_mode)) { 128 if (ShouldNavigateForward(controller, overscroll_mode)) {
129 entry = NavigationEntryImpl::FromNavigationEntry( 129 entry = controller.GetEntryAtOffset(1);
130 controller.GetEntryAtOffset(1));
131 } else if (ShouldNavigateBack(controller, overscroll_mode)) { 130 } else if (ShouldNavigateBack(controller, overscroll_mode)) {
132 entry = NavigationEntryImpl::FromNavigationEntry( 131 entry = controller.GetEntryAtOffset(-1);
133 controller.GetEntryAtOffset(-1));
134 } 132 }
135 133
136 gfx::Image image; 134 gfx::Image image;
137 if (entry && entry->screenshot().get()) { 135 if (entry && entry->screenshot().get()) {
138 std::vector<gfx::ImagePNGRep> image_reps; 136 std::vector<gfx::ImagePNGRep> image_reps;
139 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), 1.0f)); 137 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), 1.0f));
140 image = gfx::Image(image_reps); 138 image = gfx::Image(image_reps);
141 } 139 }
142 SetImage(image); 140 SetImage(image);
143 } 141 }
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 if (visible) { 1643 if (visible) {
1646 if (!web_contents_->should_normally_be_visible()) 1644 if (!web_contents_->should_normally_be_visible())
1647 web_contents_->WasShown(); 1645 web_contents_->WasShown();
1648 } else { 1646 } else {
1649 if (web_contents_->should_normally_be_visible()) 1647 if (web_contents_->should_normally_be_visible())
1650 web_contents_->WasHidden(); 1648 web_contents_->WasHidden();
1651 } 1649 }
1652 } 1650 }
1653 1651
1654 } // namespace content 1652 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/browser/web_contents/web_contents_view_aura_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698