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

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: Update to match changes in content/ CL. 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 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 } 2153 }
2154 2154
2155 void WebContentsImpl::SetClosedByUserGesture(bool value) { 2155 void WebContentsImpl::SetClosedByUserGesture(bool value) {
2156 closed_by_user_gesture_ = value; 2156 closed_by_user_gesture_ = value;
2157 } 2157 }
2158 2158
2159 bool WebContentsImpl::GetClosedByUserGesture() const { 2159 bool WebContentsImpl::GetClosedByUserGesture() const {
2160 return closed_by_user_gesture_; 2160 return closed_by_user_gesture_;
2161 } 2161 }
2162 2162
2163 int WebContentsImpl::GetZoomPercent(bool* enable_increment,
2164 bool* enable_decrement) const {
2165 *enable_decrement = *enable_increment = false;
2166 // Calculate the zoom percent from the factor. Round up to the nearest whole
2167 // number.
2168 int percent = static_cast<int>(
2169 ZoomLevelToZoomFactor(HostZoomMap::GetZoomLevel(this)) * 100 + 0.5);
2170 *enable_decrement = percent > minimum_zoom_percent_;
2171 *enable_increment = percent < maximum_zoom_percent_;
2172 return percent;
2173 }
2174
2175 void WebContentsImpl::ViewSource() { 2163 void WebContentsImpl::ViewSource() {
2176 if (!delegate_) 2164 if (!delegate_)
2177 return; 2165 return;
2178 2166
2179 NavigationEntry* entry = GetController().GetLastCommittedEntry(); 2167 NavigationEntry* entry = GetController().GetLastCommittedEntry();
2180 if (!entry) 2168 if (!entry)
2181 return; 2169 return;
2182 2170
2183 delegate_->ViewSourceForTab(this, entry->GetURL()); 2171 delegate_->ViewSourceForTab(this, entry->GetURL());
2184 } 2172 }
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
4058 4046
4059 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { 4047 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
4060 if (!delegate_) 4048 if (!delegate_)
4061 return; 4049 return;
4062 const gfx::Size new_size = GetPreferredSize(); 4050 const gfx::Size new_size = GetPreferredSize();
4063 if (new_size != old_size) 4051 if (new_size != old_size)
4064 delegate_->UpdatePreferredSize(this, new_size); 4052 delegate_->UpdatePreferredSize(this, new_size);
4065 } 4053 }
4066 4054
4067 } // namespace content 4055 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698