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

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

Issue 301733006: Zoom Extension API (chrome) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Create ZoomController for guest web contents. 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 | Annotate | Revision Log
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_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 } 2170 }
2171 2171
2172 void WebContentsImpl::SetClosedByUserGesture(bool value) { 2172 void WebContentsImpl::SetClosedByUserGesture(bool value) {
2173 closed_by_user_gesture_ = value; 2173 closed_by_user_gesture_ = value;
2174 } 2174 }
2175 2175
2176 bool WebContentsImpl::GetClosedByUserGesture() const { 2176 bool WebContentsImpl::GetClosedByUserGesture() const {
2177 return closed_by_user_gesture_; 2177 return closed_by_user_gesture_;
2178 } 2178 }
2179 2179
2180 int WebContentsImpl::GetZoomPercent(bool* enable_increment,
2181 bool* enable_decrement) const {
2182 *enable_decrement = *enable_increment = false;
2183 // Calculate the zoom percent from the factor. Round up to the nearest whole
2184 // number.
2185 int percent = static_cast<int>(
2186 ZoomLevelToZoomFactor(HostZoomMap::GetZoomLevel(this)) * 100 + 0.5);
2187 *enable_decrement = percent > minimum_zoom_percent_;
2188 *enable_increment = percent < maximum_zoom_percent_;
2189 return percent;
2190 }
2191
2192 void WebContentsImpl::ViewSource() { 2180 void WebContentsImpl::ViewSource() {
2193 if (!delegate_) 2181 if (!delegate_)
2194 return; 2182 return;
2195 2183
2196 NavigationEntry* entry = GetController().GetLastCommittedEntry(); 2184 NavigationEntry* entry = GetController().GetLastCommittedEntry();
2197 if (!entry) 2185 if (!entry)
2198 return; 2186 return;
2199 2187
2200 delegate_->ViewSourceForTab(this, entry->GetURL()); 2188 delegate_->ViewSourceForTab(this, entry->GetURL());
2201 } 2189 }
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after
4100 if (new_size != old_size) 4088 if (new_size != old_size)
4101 delegate_->UpdatePreferredSize(this, new_size); 4089 delegate_->UpdatePreferredSize(this, new_size);
4102 } 4090 }
4103 4091
4104 void WebContentsImpl::ResumeResponseDeferredAtStart() { 4092 void WebContentsImpl::ResumeResponseDeferredAtStart() {
4105 FrameTreeNode* node = frame_tree_.root(); 4093 FrameTreeNode* node = frame_tree_.root();
4106 node->render_manager()->ResumeResponseDeferredAtStart(); 4094 node->render_manager()->ResumeResponseDeferredAtStart();
4107 } 4095 }
4108 4096
4109 } // namespace content 4097 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698