diff options
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webview.h | 6 | ||||
-rw-r--r-- | webkit/glue/webview_impl.cc | 11 | ||||
-rw-r--r-- | webkit/glue/webview_impl.h | 3 | ||||
-rw-r--r-- | webkit/glue/webview_unittest.cc | 26 |
4 files changed, 46 insertions, 0 deletions
diff --git a/webkit/glue/webview.h b/webkit/glue/webview.h index 81d0094..565143d 100644 --- a/webkit/glue/webview.h +++ b/webkit/glue/webview.h @@ -230,6 +230,12 @@ class WebView : public WebKit::WebWidget { virtual void SetIsTransparent(bool is_transparent) = 0; virtual bool GetIsTransparent() const = 0; + // Updates the WebView's active state (i.e., control tints). + virtual void SetActive(bool active) = 0; + + // Gets the WebView's active state (i.e., state of control tints). + virtual bool IsActive() = 0; + private: DISALLOW_COPY_AND_ASSIGN(WebView); }; diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc index 0556ac8..04c18ef 100644 --- a/webkit/glue/webview_impl.cc +++ b/webkit/glue/webview_impl.cc @@ -1796,6 +1796,17 @@ bool WebViewImpl::GetIsTransparent() const { return is_transparent_; } +void WebViewImpl::SetActive(bool active) { + if (page() && page()->focusController()) + page()->focusController()->setActive(active); +} + +bool WebViewImpl::IsActive() { + return (page() && page()->focusController()) + ? page()->focusController()->isActive() + : false; +} + void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { if (is_new_navigation) *is_new_navigation = observed_new_navigation_; diff --git a/webkit/glue/webview_impl.h b/webkit/glue/webview_impl.h index 6c2f883..92dd080 100644 --- a/webkit/glue/webview_impl.h +++ b/webkit/glue/webview_impl.h @@ -131,6 +131,9 @@ class WebViewImpl : public WebView, public base::RefCounted<WebViewImpl> { virtual void SetIsTransparent(bool is_transparent); virtual bool GetIsTransparent() const; + virtual void SetActive(bool active); + virtual bool IsActive(); + // WebViewImpl const WebKit::WebPoint& last_mouse_down_point() const { diff --git a/webkit/glue/webview_unittest.cc b/webkit/glue/webview_unittest.cc new file mode 100644 index 0000000..c3ae5c2 --- /dev/null +++ b/webkit/glue/webview_unittest.cc @@ -0,0 +1,26 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "testing/gtest/include/gtest/gtest.h" +#include "webkit/glue/webview.h" +#include "webkit/tools/test_shell/test_shell_test.h" + +class WebViewTest : public TestShellTest { +}; + +TEST_F(WebViewTest, GetContentAsPlainText) { + WebView* view = test_shell_->webView(); + ASSERT_TRUE(view != 0); + + view->SetActive(true); + EXPECT_TRUE(view->IsActive()); + + view->SetActive(false); + EXPECT_FALSE(view->IsActive()); + + view->SetActive(true); + EXPECT_TRUE(view->IsActive()); +} + +// TODO(viettrungluu): add more tests |