OLD | NEW |
1 // Copyright (c) 2007-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2007-2009 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 "config.h" | 5 #include "config.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 MSVC_PUSH_WARNING_LEVEL(0); | 9 MSVC_PUSH_WARNING_LEVEL(0); |
10 #include "CSSStyleSelector.h" | 10 #include "CSSStyleSelector.h" |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 const std::wstring& WebViewImpl::GetInspectorSettings() const { | 1393 const std::wstring& WebViewImpl::GetInspectorSettings() const { |
1394 return inspector_settings_; | 1394 return inspector_settings_; |
1395 } | 1395 } |
1396 | 1396 |
1397 void WebViewImpl::SetInspectorSettings(const std::wstring& settings) { | 1397 void WebViewImpl::SetInspectorSettings(const std::wstring& settings) { |
1398 inspector_settings_ = settings; | 1398 inspector_settings_ = settings; |
1399 } | 1399 } |
1400 | 1400 |
1401 // Set the encoding of the current main frame to the one selected by | 1401 // Set the encoding of the current main frame to the one selected by |
1402 // a user in the encoding menu. | 1402 // a user in the encoding menu. |
1403 void WebViewImpl::SetPageEncoding(const std::wstring& encoding_name) { | 1403 void WebViewImpl::SetPageEncoding(const std::string& encoding_name) { |
1404 if (!page_.get()) | 1404 if (!page_.get()) |
1405 return; | 1405 return; |
1406 | 1406 |
1407 if (!encoding_name.empty()) { | 1407 if (!encoding_name.empty()) { |
1408 // only change override encoding, don't change default encoding | 1408 // only change override encoding, don't change default encoding |
1409 // TODO(brettw) use std::string for encoding names. | 1409 // TODO(brettw) use std::string for encoding names. |
1410 String new_encoding_name(webkit_glue::StdWStringToString(encoding_name)); | 1410 String new_encoding_name(webkit_glue::StdStringToString(encoding_name)); |
1411 page_->mainFrame()->loader()->reloadWithOverrideEncoding(new_encoding_name); | 1411 page_->mainFrame()->loader()->reloadWithOverrideEncoding(new_encoding_name); |
1412 } | 1412 } |
1413 } | 1413 } |
1414 | 1414 |
1415 // Return the canonical encoding name of current main webframe in webview. | 1415 // Return the canonical encoding name of current main webframe in webview. |
1416 std::wstring WebViewImpl::GetMainFrameEncodingName() { | 1416 std::string WebViewImpl::GetMainFrameEncodingName() { |
1417 if (!page_.get()) | 1417 if (!page_.get()) |
1418 return std::wstring(); | 1418 return std::string(); |
1419 | 1419 |
1420 String encoding_name = page_->mainFrame()->loader()->encoding(); | 1420 String encoding_name = page_->mainFrame()->loader()->encoding(); |
1421 return webkit_glue::StringToStdWString(encoding_name); | 1421 return webkit_glue::StringToStdString(encoding_name); |
1422 } | 1422 } |
1423 | 1423 |
1424 void WebViewImpl::ZoomIn(bool text_only) { | 1424 void WebViewImpl::ZoomIn(bool text_only) { |
1425 Frame* frame = main_frame()->frame(); | 1425 Frame* frame = main_frame()->frame(); |
1426 double multiplier = std::min(std::pow(kTextSizeMultiplierRatio, | 1426 double multiplier = std::min(std::pow(kTextSizeMultiplierRatio, |
1427 zoom_level_ + 1), | 1427 zoom_level_ + 1), |
1428 kMaxTextSizeMultiplier); | 1428 kMaxTextSizeMultiplier); |
1429 float zoom_factor = static_cast<float>(multiplier); | 1429 float zoom_factor = static_cast<float>(multiplier); |
1430 if (zoom_factor != frame->zoomFactor()) { | 1430 if (zoom_factor != frame->zoomFactor()) { |
1431 ++zoom_level_; | 1431 ++zoom_level_; |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1896 | 1896 |
1897 return document->focusedNode(); | 1897 return document->focusedNode(); |
1898 } | 1898 } |
1899 | 1899 |
1900 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { | 1900 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { |
1901 IntPoint doc_point( | 1901 IntPoint doc_point( |
1902 page_->mainFrame()->view()->windowToContents(pos)); | 1902 page_->mainFrame()->view()->windowToContents(pos)); |
1903 return page_->mainFrame()->eventHandler()-> | 1903 return page_->mainFrame()->eventHandler()-> |
1904 hitTestResultAtPoint(doc_point, false); | 1904 hitTestResultAtPoint(doc_point, false); |
1905 } | 1905 } |
OLD | NEW |