| OLD | NEW |
| 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 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 } | 2161 } |
| 2162 | 2162 |
| 2163 void WebContentsImpl::SetClosedByUserGesture(bool value) { | 2163 void WebContentsImpl::SetClosedByUserGesture(bool value) { |
| 2164 closed_by_user_gesture_ = value; | 2164 closed_by_user_gesture_ = value; |
| 2165 } | 2165 } |
| 2166 | 2166 |
| 2167 bool WebContentsImpl::GetClosedByUserGesture() const { | 2167 bool WebContentsImpl::GetClosedByUserGesture() const { |
| 2168 return closed_by_user_gesture_; | 2168 return closed_by_user_gesture_; |
| 2169 } | 2169 } |
| 2170 | 2170 |
| 2171 int WebContentsImpl::GetZoomPercent(bool* enable_increment, | |
| 2172 bool* enable_decrement) const { | |
| 2173 *enable_decrement = *enable_increment = false; | |
| 2174 // Calculate the zoom percent from the factor. Round up to the nearest whole | |
| 2175 // number. | |
| 2176 int percent = static_cast<int>( | |
| 2177 ZoomLevelToZoomFactor(HostZoomMap::GetZoomLevel(this)) * 100 + 0.5); | |
| 2178 *enable_decrement = percent > minimum_zoom_percent_; | |
| 2179 *enable_increment = percent < maximum_zoom_percent_; | |
| 2180 return percent; | |
| 2181 } | |
| 2182 | |
| 2183 void WebContentsImpl::ViewSource() { | 2171 void WebContentsImpl::ViewSource() { |
| 2184 if (!delegate_) | 2172 if (!delegate_) |
| 2185 return; | 2173 return; |
| 2186 | 2174 |
| 2187 NavigationEntry* entry = GetController().GetLastCommittedEntry(); | 2175 NavigationEntry* entry = GetController().GetLastCommittedEntry(); |
| 2188 if (!entry) | 2176 if (!entry) |
| 2189 return; | 2177 return; |
| 2190 | 2178 |
| 2191 delegate_->ViewSourceForTab(this, entry->GetURL()); | 2179 delegate_->ViewSourceForTab(this, entry->GetURL()); |
| 2192 } | 2180 } |
| (...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4066 | 4054 |
| 4067 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 4055 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 4068 if (!delegate_) | 4056 if (!delegate_) |
| 4069 return; | 4057 return; |
| 4070 const gfx::Size new_size = GetPreferredSize(); | 4058 const gfx::Size new_size = GetPreferredSize(); |
| 4071 if (new_size != old_size) | 4059 if (new_size != old_size) |
| 4072 delegate_->UpdatePreferredSize(this, new_size); | 4060 delegate_->UpdatePreferredSize(this, new_size); |
| 4073 } | 4061 } |
| 4074 | 4062 |
| 4075 } // namespace content | 4063 } // namespace content |
| OLD | NEW |