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

Side by Side Diff: webkit/glue/webview_impl.cc

Issue 246060: Revert 27705 - Move various methods from glue/webview.h to api/public/WebView... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | webkit/glue/webview_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 // WebView ---------------------------------------------------------------- 332 // WebView ----------------------------------------------------------------
333 333
334 /*static*/ 334 /*static*/
335 WebView* WebView::Create(WebViewDelegate* delegate) { 335 WebView* WebView::Create(WebViewDelegate* delegate) {
336 WebViewImpl* instance = new WebViewImpl(delegate); 336 WebViewImpl* instance = new WebViewImpl(delegate);
337 instance->AddRef(); 337 instance->AddRef();
338 return instance; 338 return instance;
339 } 339 }
340 340
341 void WebViewImpl::initializeMainFrame(WebFrameClient* frame_client) { 341 void WebViewImpl::InitializeMainFrame(WebFrameClient* frame_client) {
342 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame 342 // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame
343 // and releases that reference once the corresponding Frame is destroyed. 343 // and releases that reference once the corresponding Frame is destroyed.
344 scoped_refptr<WebFrameImpl> main_frame = new WebFrameImpl(frame_client); 344 scoped_refptr<WebFrameImpl> main_frame = new WebFrameImpl(frame_client);
345 345
346 main_frame->InitMainFrame(this); 346 main_frame->InitMainFrame(this);
347 347
348 if (delegate_) { 348 if (delegate_) {
349 WebDevToolsAgentDelegate* tools_delegate = 349 WebDevToolsAgentDelegate* tools_delegate =
350 delegate_->GetWebDevToolsAgentDelegate(); 350 delegate_->GetWebDevToolsAgentDelegate();
351 if (tools_delegate) 351 if (tools_delegate)
(...skipping 11 matching lines...) Expand all
363 WebCore::Page::visitedStateChanged( 363 WebCore::Page::visitedStateChanged(
364 WebCore::PageGroup::pageGroup(kPageGroupName), link_hash); 364 WebCore::PageGroup::pageGroup(kPageGroupName), link_hash);
365 } 365 }
366 366
367 // static 367 // static
368 void WebView::ResetVisitedLinkState() { 368 void WebView::ResetVisitedLinkState() {
369 WebCore::Page::allVisitedStateChanged( 369 WebCore::Page::allVisitedStateChanged(
370 WebCore::PageGroup::pageGroup(kPageGroupName)); 370 WebCore::PageGroup::pageGroup(kPageGroupName));
371 } 371 }
372 372
373
373 WebViewImpl::WebViewImpl(WebViewDelegate* delegate) 374 WebViewImpl::WebViewImpl(WebViewDelegate* delegate)
374 : delegate_(delegate), 375 : delegate_(delegate),
375 ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)), 376 ALLOW_THIS_IN_INITIALIZER_LIST(back_forward_list_client_impl_(this)),
376 ALLOW_THIS_IN_INITIALIZER_LIST(chrome_client_impl_(this)), 377 ALLOW_THIS_IN_INITIALIZER_LIST(chrome_client_impl_(this)),
377 ALLOW_THIS_IN_INITIALIZER_LIST(context_menu_client_impl_(this)), 378 ALLOW_THIS_IN_INITIALIZER_LIST(context_menu_client_impl_(this)),
378 ALLOW_THIS_IN_INITIALIZER_LIST(drag_client_impl_(this)), 379 ALLOW_THIS_IN_INITIALIZER_LIST(drag_client_impl_(this)),
379 ALLOW_THIS_IN_INITIALIZER_LIST(editor_client_impl_(this)), 380 ALLOW_THIS_IN_INITIALIZER_LIST(editor_client_impl_(this)),
380 ALLOW_THIS_IN_INITIALIZER_LIST(inspector_client_impl_(this)), 381 ALLOW_THIS_IN_INITIALIZER_LIST(inspector_client_impl_(this)),
381 observed_new_navigation_(false), 382 observed_new_navigation_(false),
382 #ifndef NDEBUG 383 #ifndef NDEBUG
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 418 }
418 419
419 WebViewImpl::~WebViewImpl() { 420 WebViewImpl::~WebViewImpl() {
420 DCHECK(page_ == NULL); 421 DCHECK(page_ == NULL);
421 } 422 }
422 423
423 RenderTheme* WebViewImpl::theme() const { 424 RenderTheme* WebViewImpl::theme() const {
424 return page_.get() ? page_->theme() : RenderTheme::defaultTheme().get(); 425 return page_.get() ? page_->theme() : RenderTheme::defaultTheme().get();
425 } 426 }
426 427
427 bool WebViewImpl::tabKeyCyclesThroughElements() const { 428 void WebViewImpl::SetTabKeyCyclesThroughElements(bool value) {
428 ASSERT(page_.get());
429 return page_->tabKeyCyclesThroughElements();
430 }
431
432 void WebViewImpl::setTabKeyCyclesThroughElements(bool value) {
433 if (page_ != NULL) { 429 if (page_ != NULL) {
434 page_->setTabKeyCyclesThroughElements(value); 430 page_->setTabKeyCyclesThroughElements(value);
435 } 431 }
436 } 432 }
437 433
438 void WebViewImpl::MouseMove(const WebMouseEvent& event) { 434 void WebViewImpl::MouseMove(const WebMouseEvent& event) {
439 if (!main_frame() || !main_frame()->frameview()) 435 if (!main_frame() || !main_frame()->frameview())
440 return; 436 return;
441 437
442 last_mouse_position_ = WebPoint(event.x, event.y); 438 last_mouse_position_ = WebPoint(event.x, event.y);
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 page_->inspectorController()->inspect(result.innerNonSharedNode()); 1600 page_->inspectorController()->inspect(result.innerNonSharedNode());
1605 } 1601 }
1606 } 1602 }
1607 1603
1608 // WebView -------------------------------------------------------------------- 1604 // WebView --------------------------------------------------------------------
1609 1605
1610 WebViewDelegate* WebViewImpl::GetDelegate() { 1606 WebViewDelegate* WebViewImpl::GetDelegate() {
1611 return delegate_; 1607 return delegate_;
1612 } 1608 }
1613 1609
1610 WebFrame* WebViewImpl::GetPreviousFrameBefore(WebFrame* frame, bool wrap) {
1611 WebFrameImpl* frame_impl = static_cast<WebFrameImpl*>(frame);
1612 WebCore::Frame* previous =
1613 frame_impl->frame()->tree()->traversePreviousWithWrap(wrap);
1614 return previous ? WebFrameImpl::FromFrame(previous) : NULL;
1615 }
1616
1617 WebFrame* WebViewImpl::GetNextFrameAfter(WebFrame* frame, bool wrap) {
1618 WebFrameImpl* frame_impl = static_cast<WebFrameImpl*>(frame);
1619 WebCore::Frame* next =
1620 frame_impl->frame()->tree()->traverseNextWithWrap(wrap);
1621 return next ? WebFrameImpl::FromFrame(next) : NULL;
1622 }
1623
1624 // TODO(darin): these navigation methods should be killed
1625
1626 void WebViewImpl::StopLoading() {
1627 main_frame()->stopLoading();
1628 }
1629
1630 void WebViewImpl::SetBackForwardListSize(int size) {
1631 page_->backForwardList()->setCapacity(size);
1632 }
1633
1614 const std::wstring& WebViewImpl::GetInspectorSettings() const { 1634 const std::wstring& WebViewImpl::GetInspectorSettings() const {
1615 return inspector_settings_; 1635 return inspector_settings_;
1616 } 1636 }
1617 1637
1618 void WebViewImpl::SetInspectorSettings(const std::wstring& settings) { 1638 void WebViewImpl::SetInspectorSettings(const std::wstring& settings) {
1619 inspector_settings_ = settings; 1639 inspector_settings_ = settings;
1620 } 1640 }
1621 1641
1622 bool WebViewImpl::setDropEffect(bool accept) { 1642 void WebViewImpl::ShowJavaScriptConsole() {
1643 page_->inspectorController()->showPanel(InspectorController::ConsolePanel);
1644 }
1645
1646 bool WebViewImpl::SetDropEffect(bool accept) {
1623 if (drag_target_dispatch_) { 1647 if (drag_target_dispatch_) {
1624 drop_effect_ = accept ? DROP_EFFECT_COPY : DROP_EFFECT_NONE; 1648 drop_effect_ = accept ? DROP_EFFECT_COPY : DROP_EFFECT_NONE;
1625 return true; 1649 return true;
1626 } else { 1650 } else {
1627 return false; 1651 return false;
1628 } 1652 }
1629 } 1653 }
1630 1654
1631 void WebViewImpl::AutofillSuggestionsForNode( 1655 void WebViewImpl::AutofillSuggestionsForNode(
1632 int64 node_id, 1656 int64 node_id,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 } 1714 }
1691 1715
1692 WebDevToolsAgent* WebViewImpl::GetWebDevToolsAgent() { 1716 WebDevToolsAgent* WebViewImpl::GetWebDevToolsAgent() {
1693 return GetWebDevToolsAgentImpl(); 1717 return GetWebDevToolsAgentImpl();
1694 } 1718 }
1695 1719
1696 WebDevToolsAgentImpl* WebViewImpl::GetWebDevToolsAgentImpl() { 1720 WebDevToolsAgentImpl* WebViewImpl::GetWebDevToolsAgentImpl() {
1697 return devtools_agent_.get(); 1721 return devtools_agent_.get();
1698 } 1722 }
1699 1723
1700 void WebViewImpl::setIsTransparent(bool is_transparent) { 1724 void WebViewImpl::SetIsTransparent(bool is_transparent) {
1701 // Set any existing frames to be transparent. 1725 // Set any existing frames to be transparent.
1702 WebCore::Frame* frame = page_->mainFrame(); 1726 WebCore::Frame* frame = page_->mainFrame();
1703 while (frame) { 1727 while (frame) {
1704 frame->view()->setTransparent(is_transparent); 1728 frame->view()->setTransparent(is_transparent);
1705 frame = frame->tree()->traverseNext(); 1729 frame = frame->tree()->traverseNext();
1706 } 1730 }
1707 1731
1708 // Future frames check this to know whether to be transparent. 1732 // Future frames check this to know whether to be transparent.
1709 is_transparent_ = is_transparent; 1733 is_transparent_ = is_transparent;
1710 } 1734 }
1711 1735
1712 bool WebViewImpl::isTransparent() const { 1736 bool WebViewImpl::GetIsTransparent() const {
1713 return is_transparent_; 1737 return is_transparent_;
1714 } 1738 }
1715 1739
1716 void WebViewImpl::MediaPlayerActionAt(int x, 1740 void WebViewImpl::MediaPlayerActionAt(int x,
1717 int y, 1741 int y,
1718 const MediaPlayerAction& action) { 1742 const MediaPlayerAction& action) {
1719 HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y)); 1743 HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y));
1720 1744
1721 WTF::RefPtr<WebCore::Node> node = result.innerNonSharedNode(); 1745 WTF::RefPtr<WebCore::Node> node = result.innerNonSharedNode();
1722 if (node->hasTagName(WebCore::HTMLNames::videoTag) || 1746 if (node->hasTagName(WebCore::HTMLNames::videoTag) ||
(...skipping 14 matching lines...) Expand all
1737 } 1761 }
1738 if (action.command & MediaPlayerAction::LOOP) { 1762 if (action.command & MediaPlayerAction::LOOP) {
1739 media_element->setLoop(true); 1763 media_element->setLoop(true);
1740 } 1764 }
1741 if (action.command & MediaPlayerAction::NO_LOOP) { 1765 if (action.command & MediaPlayerAction::NO_LOOP) {
1742 media_element->setLoop(false); 1766 media_element->setLoop(false);
1743 } 1767 }
1744 } 1768 }
1745 } 1769 }
1746 1770
1747 void WebViewImpl::setIsActive(bool active) { 1771 void WebViewImpl::SetActive(bool active) {
1748 if (page() && page()->focusController()) 1772 if (page() && page()->focusController())
1749 page()->focusController()->setActive(active); 1773 page()->focusController()->setActive(active);
1750 } 1774 }
1751 1775
1752 bool WebViewImpl::isActive() const { 1776 bool WebViewImpl::IsActive() {
1753 return (page() && page()->focusController()) 1777 return (page() && page()->focusController())
1754 ? page()->focusController()->isActive() 1778 ? page()->focusController()->isActive()
1755 : false; 1779 : false;
1756 } 1780 }
1757 1781
1758 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { 1782 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) {
1759 if (is_new_navigation) 1783 if (is_new_navigation)
1760 *is_new_navigation = observed_new_navigation_; 1784 *is_new_navigation = observed_new_navigation_;
1761 1785
1762 #ifndef NDEBUG 1786 #ifndef NDEBUG
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 } 1890 }
1867 1891
1868 void WebViewImpl::SetSpellingPanelVisibility(bool is_visible) { 1892 void WebViewImpl::SetSpellingPanelVisibility(bool is_visible) {
1869 spelling_panel_is_visible_ = is_visible; 1893 spelling_panel_is_visible_ = is_visible;
1870 } 1894 }
1871 1895
1872 bool WebViewImpl::GetSpellingPanelVisibility() { 1896 bool WebViewImpl::GetSpellingPanelVisibility() {
1873 return spelling_panel_is_visible_; 1897 return spelling_panel_is_visible_;
1874 } 1898 }
1875 1899
1876 void WebViewImpl::setTabsToLinks(bool enable) { 1900 void WebViewImpl::SetTabsToLinks(bool enable) {
1877 tabs_to_links_ = enable; 1901 tabs_to_links_ = enable;
1878 } 1902 }
1879 1903
1880 bool WebViewImpl::tabsToLinks() const { 1904 bool WebViewImpl::GetTabsToLinks() const {
1881 return tabs_to_links_; 1905 return tabs_to_links_;
1882 } 1906 }
OLDNEW
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | webkit/glue/webview_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698