diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 20:51:01 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 20:51:01 +0000 |
commit | 3921d1954d9dfe490d179fe2c750bcab4980d533 (patch) | |
tree | 37d27749acb449a9807b4b4c355edcaf19fa5f57 /chrome_frame | |
parent | 21805a1bb44a59bfbb3ff1741b3efd2bc4e0667e (diff) | |
download | chromium_src-3921d1954d9dfe490d179fe2c750bcab4980d533.zip chromium_src-3921d1954d9dfe490d179fe2c750bcab4980d533.tar.gz chromium_src-3921d1954d9dfe490d179fe2c750bcab4980d533.tar.bz2 |
Revert 42366 - Allow TabContentsDelegate classes to specify whether InfoBars are enabled.
Allow ChromeFrame to pass infobar enabled parameter to ExternalTabContainer.
BUG=2444936
Patch contributed by ericdingle@google.com
Original review at http://codereview.chromium.org/890005
TBR=joi@chromium.org
Review URL: http://codereview.chromium.org/1205001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/chrome_active_document.cc | 3 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex.cc | 2 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.cc | 25 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.h | 7 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_npapi.cc | 2 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_npapi_unittest.cc | 14 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_plugin.h | 16 | ||||
-rw-r--r-- | chrome_frame/test/automation_client_mock.cc | 73 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_automation_mock.h | 26 |
9 files changed, 45 insertions, 123 deletions
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index dbc2b8b..fe9499d 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -1004,8 +1004,7 @@ bool ChromeActiveDocument::LaunchUrl(const std::wstring& url, automation_client_->SetUrlFetcher(&url_fetcher_); - if (InitializeAutomation(GetHostProcessName(false), L"", IsIEInPrivate(), - false)) + if (InitializeAutomation(GetHostProcessName(false), L"", IsIEInPrivate())) return true; return false; diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc index f982072..a88c5f1 100644 --- a/chrome_frame/chrome_frame_activex.cc +++ b/chrome_frame/chrome_frame_activex.cc @@ -447,7 +447,7 @@ HRESULT ChromeFrameActivex::IOleObject_SetClientSite( url_fetcher_.set_frame_busting(!is_privileged_); automation_client_->SetUrlFetcher(&url_fetcher_); if (!InitializeAutomation(profile_name, chrome_extra_arguments, - IsIEInPrivate(), true)) { + IsIEInPrivate())) { return E_FAIL; } } diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index b170908..785e3e5 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -450,10 +450,13 @@ ChromeFrameAutomationClient::~ChromeFrameAutomationClient() { bool ChromeFrameAutomationClient::Initialize( ChromeFrameDelegate* chrome_frame_delegate, - const ChromeFrameLaunchParams& chrome_launch_params) { + int automation_server_launch_timeout, + bool perform_version_check, + const std::wstring& profile_name, + const std::wstring& extra_chrome_arguments, + bool incognito) { DCHECK(!IsWindow()); chrome_frame_delegate_ = chrome_frame_delegate; - chrome_launch_params_ = chrome_launch_params; ui_thread_id_ = PlatformThread::CurrentId(); #ifndef NDEBUG // In debug mode give more time to work with a debugger. @@ -461,11 +464,10 @@ bool ChromeFrameAutomationClient::Initialize( // Don't use INFINITE (which is -1) or even MAXINT since we will convert // from milliseconds to microseconds when stored in a base::TimeDelta, // thus * 1000. An hour should be enough. - chrome_launch_params_.automation_server_launch_timeout = 60 * 60 * 1000; + automation_server_launch_timeout = 60 * 60 * 1000; } else { - DCHECK_LT(chrome_launch_params_.automation_server_launch_timeout, - MAXINT / 2000); - chrome_launch_params_.automation_server_launch_timeout *= 2; + DCHECK_LT(automation_server_launch_timeout, MAXINT / 2000); + automation_server_launch_timeout *= 2; } #endif // NDEBUG @@ -488,9 +490,13 @@ bool ChromeFrameAutomationClient::Initialize( // InitializeComplete is called successfully. init_state_ = INITIALIZING; - if (navigate_after_initialization_) { - chrome_launch_params_.url = url_; - } + chrome_launch_params_.automation_server_launch_timeout = + automation_server_launch_timeout; + chrome_launch_params_.profile_name = profile_name; + chrome_launch_params_.extra_chrome_arguments = extra_chrome_arguments; + chrome_launch_params_.perform_version_check = perform_version_check; + chrome_launch_params_.url = navigate_after_initialization_ ? GURL() : url_; + chrome_launch_params_.incognito_mode = incognito; proxy_factory_->GetAutomationServer( static_cast<ProxyFactory::LaunchDelegate*>(this), @@ -835,7 +841,6 @@ void ChromeFrameAutomationClient::CreateExternalTab() { handle_top_level_requests_, chrome_launch_params_.url, chrome_launch_params_.referrer, - !chrome_launch_params_.is_widget_mode // Infobars disabled in widget mode. }; THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS( diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h index bd839a4..f01d1b4 100644 --- a/chrome_frame/chrome_frame_automation.h +++ b/chrome_frame/chrome_frame_automation.h @@ -88,7 +88,6 @@ struct ChromeFrameLaunchParams { std::wstring extra_chrome_arguments; bool perform_version_check; bool incognito_mode; - bool is_widget_mode; }; // We must create and destroy automation proxy in a thread with a message loop. @@ -159,7 +158,11 @@ class ChromeFrameAutomationClient // Called from UI thread. virtual bool Initialize(ChromeFrameDelegate* chrome_frame_delegate, - const ChromeFrameLaunchParams& chrome_launch_params); + int automation_server_launch_timeout, + bool perform_version_check, + const std::wstring& profile_name, + const std::wstring& extra_chrome_arguments, + bool incognito); void Uninitialize(); virtual bool InitiateNavigation(const std::string& url, diff --git a/chrome_frame/chrome_frame_npapi.cc b/chrome_frame/chrome_frame_npapi.cc index 6fbd76a..573d32e 100644 --- a/chrome_frame/chrome_frame_npapi.cc +++ b/chrome_frame/chrome_frame_npapi.cc @@ -320,7 +320,7 @@ bool ChromeFrameNPAPI::Initialize(NPMIMEType mime_type, NPP instance, // TODO(stoyan): Ask host for specific interface whether to honor // host's in-private mode. return InitializeAutomation(profile_name, extra_arguments, - GetBrowserIncognitoMode(), true); + GetBrowserIncognitoMode()); } void ChromeFrameNPAPI::Uninitialize() { diff --git a/chrome_frame/chrome_frame_npapi_unittest.cc b/chrome_frame/chrome_frame_npapi_unittest.cc index 4d03b00..b30d5e8 100644 --- a/chrome_frame/chrome_frame_npapi_unittest.cc +++ b/chrome_frame/chrome_frame_npapi_unittest.cc @@ -20,7 +20,6 @@ namespace { using ::testing::_; using ::testing::Eq; -using ::testing::Field; using ::testing::Invoke; using ::testing::Return; using ::testing::StrEq; @@ -81,7 +80,9 @@ class MockNPAPI: public ChromeFrameNPAPI { class MockAutomationClient: public ChromeFrameAutomationClient { public: - MOCK_METHOD2(Initialize, bool(ChromeFrameDelegate*, ChromeFrameLaunchParams)); + MOCK_METHOD6(Initialize, bool(ChromeFrameDelegate*, int, bool, + const std::wstring&, const std::wstring&, + bool)); MOCK_METHOD1(SetEnableExtensionAutomation, void(const std::vector<std::string>&)); // NOLINT }; @@ -126,14 +127,7 @@ class TestNPAPIPrivilegedApi: public ::testing::Test { EXPECT_CALL(*mock_proxy, Initialize(_, _)).WillRepeatedly(Return(false)); EXPECT_CALL(*mock_automation, - Initialize(_, AllOf( - Field(&ChromeFrameLaunchParams::perform_version_check, true), - Field(&ChromeFrameLaunchParams::profile_name, - StrEq(profile_name)), - Field(&ChromeFrameLaunchParams::extra_chrome_arguments, - StrEq(extra_args)), - Field(&ChromeFrameLaunchParams::incognito_mode, is_incognito), - Field(&ChromeFrameLaunchParams::is_widget_mode, true)))) + Initialize(_, _, true, StrEq(profile_name), StrEq(extra_args), false)) .WillOnce(Return(true)); if (expect_privilege_check) { diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h index 641d7a7..078a611 100644 --- a/chrome_frame/chrome_frame_plugin.h +++ b/chrome_frame/chrome_frame_plugin.h @@ -51,22 +51,14 @@ END_MSG_MAP() bool InitializeAutomation(const std::wstring& profile_name, const std::wstring& extra_chrome_arguments, - bool incognito, bool is_widget_mode) { + bool incognito) { DCHECK(IsValid()); // We don't want to do incognito when privileged, since we're // running in browser chrome or some other privileged context. bool incognito_mode = !is_privileged_ && incognito; - ChromeFrameLaunchParams chrome_launch_params = { - kCommandExecutionTimeout, - GURL(), - GURL(), - profile_name, - extra_chrome_arguments, - true, - incognito_mode, - is_widget_mode - }; - return automation_client_->Initialize(this, chrome_launch_params); + return automation_client_->Initialize(this, kCommandExecutionTimeout, true, + profile_name, extra_chrome_arguments, + incognito_mode); } // ChromeFrameDelegate implementation diff --git a/chrome_frame/test/automation_client_mock.cc b/chrome_frame/test/automation_client_mock.cc index b64a7cb..f699635 100644 --- a/chrome_frame/test/automation_client_mock.cc +++ b/chrome_frame/test/automation_client_mock.cc @@ -100,17 +100,7 @@ TEST(CFACWithChrome, CreateTooFast) { .Times(1) .WillOnce(QUIT_LOOP(loop)); - ChromeFrameLaunchParams cfp = { - timeout, - GURL(), - GURL(), - profile, - L"", - false, - false, - false - }; - EXPECT_TRUE(client->Initialize(&cfd, cfp)); + EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile, L"", false)); loop.RunFor(10); client->Uninitialize(); } @@ -135,17 +125,7 @@ TEST(CFACWithChrome, CreateNotSoFast) { EXPECT_CALL(cfd, OnAutomationServerLaunchFailed(_, _)) .Times(0); - ChromeFrameLaunchParams cfp = { - timeout, - GURL(), - GURL(), - profile, - L"", - false, - false, - false - }; - EXPECT_TRUE(client->Initialize(&cfd, cfp)); + EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile, L"", false)); loop.RunFor(11); client->Uninitialize(); @@ -185,17 +165,7 @@ TEST(CFACWithChrome, NavigateOk) { .WillOnce(QUIT_LOOP(loop)); } - ChromeFrameLaunchParams cfp = { - timeout, - GURL(), - GURL(), - profile, - L"", - false, - false, - false - }; - EXPECT_TRUE(client->Initialize(&cfd, cfp)); + EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile, L"", false)); loop.RunFor(10); client->Uninitialize(); client = NULL; @@ -234,17 +204,7 @@ TEST(CFACWithChrome, NavigateFailed) { .Times(1) .WillOnce(QUIT_LOOP_SOON(loop, 2)); - ChromeFrameLaunchParams cfp = { - 10000, - GURL(), - GURL(), - profile, - L"", - false, - false, - false - }; - EXPECT_TRUE(client->Initialize(&cfd, cfp)); + EXPECT_TRUE(client->Initialize(&cfd, 10000, false, profile, L"", false)); loop.RunFor(10); client->Uninitialize(); @@ -277,17 +237,7 @@ TEST_F(CFACMockTest, MockedCreateTabOk) { EXPECT_CALL(proxy_, CancelAsync(_)).Times(testing::AnyNumber()); // Here we go! - ChromeFrameLaunchParams cfp = { - timeout, - GURL(), - GURL(), - profile_, - L"", - false, - false, - false - }; - EXPECT_TRUE(client_->Initialize(&cfd_, cfp)); + EXPECT_TRUE(client_->Initialize(&cfd_, timeout, false, profile_, L"", false)); loop_.RunFor(10); client_->Uninitialize(); } @@ -312,17 +262,8 @@ TEST_F(CFACMockTest, MockedCreateTabFailed) { Set_CFD_LaunchFailed(AUTOMATION_CREATE_TAB_FAILED); // Here we go! - ChromeFrameLaunchParams cfp = { - timeout_, - GURL(), - GURL(), - profile_, - L"", - false, - false, - false - }; - EXPECT_TRUE(client_->Initialize(&cfd_, cfp)); + EXPECT_TRUE(client_->Initialize(&cfd_, timeout_, false, profile_, L"", + false)); loop_.RunFor(4); client_->Uninitialize(); } diff --git a/chrome_frame/test/chrome_frame_automation_mock.h b/chrome_frame/test/chrome_frame_automation_mock.h index d751f1b..6fea200 100644 --- a/chrome_frame/test/chrome_frame_automation_mock.h +++ b/chrome_frame/test/chrome_frame_automation_mock.h @@ -20,23 +20,13 @@ class AutomationMockDelegate AutomationMockDelegate(MessageLoop* caller_message_loop, int launch_timeout, bool perform_version_check, const std::wstring& profile_name, - const std::wstring& extra_chrome_arguments, bool incognito, - bool is_widget_mode) + const std::wstring& extra_chrome_arguments, bool incognito) : caller_message_loop_(caller_message_loop), is_connected_(false), navigation_result_(false) { test_server_.SetUp(); automation_client_ = new ChromeFrameAutomationClient; - ChromeFrameLaunchParams cfp = { - launch_timeout, - GURL(), - GURL(), - profile_name, - extra_chrome_arguments, - perform_version_check, - incognito, - is_widget_mode - }; - automation_client_->Initialize(this, cfp); + automation_client_->Initialize(this, launch_timeout, perform_version_check, + profile_name, extra_chrome_arguments, incognito); } ~AutomationMockDelegate() { if (automation_client_.get()) { @@ -140,8 +130,7 @@ class AutomationMockLaunch typedef AutomationMockDelegate<AutomationMockLaunch> Base; AutomationMockLaunch(MessageLoop* caller_message_loop, int launch_timeout) - : Base(caller_message_loop, launch_timeout, true, L"", L"", false, - false) { + : Base(caller_message_loop, launch_timeout, true, L"", L"", false) { } virtual void OnAutomationServerReady() { Base::OnAutomationServerReady(); @@ -158,8 +147,7 @@ class AutomationMockNavigate typedef AutomationMockDelegate<AutomationMockNavigate> Base; AutomationMockNavigate(MessageLoop* caller_message_loop, int launch_timeout) - : Base(caller_message_loop, launch_timeout, true, L"", L"", false, - false) { + : Base(caller_message_loop, launch_timeout, true, L"", L"", false) { } virtual void OnLoad(int tab_handle, const GURL& url) { Base::OnLoad(tab_handle, url); @@ -173,7 +161,7 @@ class AutomationMockPostMessage typedef AutomationMockDelegate<AutomationMockPostMessage> Base; AutomationMockPostMessage(MessageLoop* caller_message_loop, int launch_timeout) - : Base(caller_message_loop, launch_timeout, true, L"", L"", false, false), + : Base(caller_message_loop, launch_timeout, true, L"", L"", false), postmessage_result_(false) {} bool postmessage_result() const { return postmessage_result_; @@ -201,7 +189,7 @@ class AutomationMockHostNetworkRequestStart typedef AutomationMockDelegate<AutomationMockHostNetworkRequestStart> Base; AutomationMockHostNetworkRequestStart(MessageLoop* caller_message_loop, int launch_timeout) - : Base(caller_message_loop, launch_timeout, true, L"", L"", false, false), + : Base(caller_message_loop, launch_timeout, true, L"", L"", false), request_start_result_(false) { if (automation()) { automation()->set_use_chrome_network(false); |