| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // text zoom to half and 3x the original text size. These three values match | 125 // text zoom to half and 3x the original text size. These three values match |
| 126 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm | 126 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm |
| 127 static const double kTextSizeMultiplierRatio = 1.2; | 127 static const double kTextSizeMultiplierRatio = 1.2; |
| 128 static const double kMinTextSizeMultiplier = 0.5; | 128 static const double kMinTextSizeMultiplier = 0.5; |
| 129 static const double kMaxTextSizeMultiplier = 3.0; | 129 static const double kMaxTextSizeMultiplier = 3.0; |
| 130 | 130 |
| 131 // The group name identifies a namespace of pages. Page group is used on OSX | 131 // The group name identifies a namespace of pages. Page group is used on OSX |
| 132 // for some programs that use HTML views to display things that don't seem like | 132 // for some programs that use HTML views to display things that don't seem like |
| 133 // web pages to the user (so shouldn't have visited link coloring). We only use | 133 // web pages to the user (so shouldn't have visited link coloring). We only use |
| 134 // one page group. | 134 // one page group. |
| 135 static const char* kPageGroupName = "default"; | 135 // FIXME: This needs to go into the WebKit API implementation and be hidden |
| 136 // from the API's users. |
| 137 const char* pageGroupName = "default"; |
| 136 | 138 |
| 137 // Ensure that the WebKit::WebDragOperation enum values stay in sync with | 139 // Ensure that the WebKit::WebDragOperation enum values stay in sync with |
| 138 // the original WebCore::DragOperation constants. | 140 // the original WebCore::DragOperation constants. |
| 139 #define COMPILE_ASSERT_MATCHING_ENUM(webcore_name) \ | 141 #define COMPILE_ASSERT_MATCHING_ENUM(webcore_name) \ |
| 140 COMPILE_ASSERT(int(WebCore::webcore_name) == int(WebKit::Web##webcore_name),\ | 142 COMPILE_ASSERT(int(WebCore::webcore_name) == int(WebKit::Web##webcore_name),\ |
| 141 dummy##webcore_name) | 143 dummy##webcore_name) |
| 142 COMPILE_ASSERT_MATCHING_ENUM(DragOperationNone); | 144 COMPILE_ASSERT_MATCHING_ENUM(DragOperationNone); |
| 143 COMPILE_ASSERT_MATCHING_ENUM(DragOperationCopy); | 145 COMPILE_ASSERT_MATCHING_ENUM(DragOperationCopy); |
| 144 COMPILE_ASSERT_MATCHING_ENUM(DragOperationLink); | 146 COMPILE_ASSERT_MATCHING_ENUM(DragOperationLink); |
| 145 COMPILE_ASSERT_MATCHING_ENUM(DragOperationGeneric); | 147 COMPILE_ASSERT_MATCHING_ENUM(DragOperationGeneric); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 357 |
| 356 // Restrict the access to the local file system | 358 // Restrict the access to the local file system |
| 357 // (see WebView.mm WebView::_commonInitializationWithFrameName). | 359 // (see WebView.mm WebView::_commonInitializationWithFrameName). |
| 358 FrameLoader::setLocalLoadPolicy( | 360 FrameLoader::setLocalLoadPolicy( |
| 359 FrameLoader::AllowLocalLoadsForLocalOnly); | 361 FrameLoader::AllowLocalLoadsForLocalOnly); |
| 360 } | 362 } |
| 361 | 363 |
| 362 // static | 364 // static |
| 363 void WebView::UpdateVisitedLinkState(uint64 link_hash) { | 365 void WebView::UpdateVisitedLinkState(uint64 link_hash) { |
| 364 WebCore::Page::visitedStateChanged( | 366 WebCore::Page::visitedStateChanged( |
| 365 WebCore::PageGroup::pageGroup(kPageGroupName), link_hash); | 367 WebCore::PageGroup::pageGroup(pageGroupName), link_hash); |
| 366 } | 368 } |
| 367 | 369 |
| 368 // static | 370 // static |
| 369 void WebView::ResetVisitedLinkState() { | 371 void WebView::ResetVisitedLinkState() { |
| 370 WebCore::Page::allVisitedStateChanged( | 372 WebCore::Page::allVisitedStateChanged( |
| 371 WebCore::PageGroup::pageGroup(kPageGroupName)); | 373 WebCore::PageGroup::pageGroup(pageGroupName)); |
| 372 } | 374 } |
| 373 | 375 |
| 374 WebViewImpl::WebViewImpl(WebViewDelegate* delegate) | 376 WebViewImpl::WebViewImpl(WebViewDelegate* delegate) |
| 375 : delegate_(delegate), | 377 : delegate_(delegate), |
| 376 ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)), | 378 ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)), |
| 377 ALLOW_THIS_IN_INITIALIZER_LIST(chrome_client_impl_(this)), | 379 ALLOW_THIS_IN_INITIALIZER_LIST(chrome_client_impl_(this)), |
| 378 ALLOW_THIS_IN_INITIALIZER_LIST(context_menu_client_impl_(this)), | 380 ALLOW_THIS_IN_INITIALIZER_LIST(context_menu_client_impl_(this)), |
| 379 ALLOW_THIS_IN_INITIALIZER_LIST(drag_client_impl_(this)), | 381 ALLOW_THIS_IN_INITIALIZER_LIST(drag_client_impl_(this)), |
| 380 ALLOW_THIS_IN_INITIALIZER_LIST(editor_client_impl_(this)), | 382 ALLOW_THIS_IN_INITIALIZER_LIST(editor_client_impl_(this)), |
| 381 ALLOW_THIS_IN_INITIALIZER_LIST(inspector_client_impl_(this)), | 383 ALLOW_THIS_IN_INITIALIZER_LIST(inspector_client_impl_(this)), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 407 | 409 |
| 408 // the page will take ownership of the various clients | 410 // the page will take ownership of the various clients |
| 409 page_.reset(new Page(&chrome_client_impl_, | 411 page_.reset(new Page(&chrome_client_impl_, |
| 410 &context_menu_client_impl_, | 412 &context_menu_client_impl_, |
| 411 &editor_client_impl_, | 413 &editor_client_impl_, |
| 412 &drag_client_impl_, | 414 &drag_client_impl_, |
| 413 &inspector_client_impl_, | 415 &inspector_client_impl_, |
| 414 NULL)); | 416 NULL)); |
| 415 | 417 |
| 416 page_->backForwardList()->setClient(&back_forward_list_client_impl_); | 418 page_->backForwardList()->setClient(&back_forward_list_client_impl_); |
| 417 page_->setGroupName(kPageGroupName); | 419 page_->setGroupName(pageGroupName); |
| 418 } | 420 } |
| 419 | 421 |
| 420 WebViewImpl::~WebViewImpl() { | 422 WebViewImpl::~WebViewImpl() { |
| 421 DCHECK(page_ == NULL); | 423 DCHECK(page_ == NULL); |
| 422 } | 424 } |
| 423 | 425 |
| 424 RenderTheme* WebViewImpl::theme() const { | 426 RenderTheme* WebViewImpl::theme() const { |
| 425 return page_.get() ? page_->theme() : RenderTheme::defaultTheme().get(); | 427 return page_.get() ? page_->theme() : RenderTheme::defaultTheme().get(); |
| 426 } | 428 } |
| 427 | 429 |
| (...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 return spelling_panel_is_visible_; | 1905 return spelling_panel_is_visible_; |
| 1904 } | 1906 } |
| 1905 | 1907 |
| 1906 void WebViewImpl::setTabsToLinks(bool enable) { | 1908 void WebViewImpl::setTabsToLinks(bool enable) { |
| 1907 tabs_to_links_ = enable; | 1909 tabs_to_links_ = enable; |
| 1908 } | 1910 } |
| 1909 | 1911 |
| 1910 bool WebViewImpl::tabsToLinks() const { | 1912 bool WebViewImpl::tabsToLinks() const { |
| 1911 return tabs_to_links_; | 1913 return tabs_to_links_; |
| 1912 } | 1914 } |
| OLD | NEW |