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