diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-12 18:40:01 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-12 18:40:01 +0000 |
commit | cccd376dcdb2cc8855c7ca1fd649a948d68d6f08 (patch) | |
tree | 5b7dc1ac2b4ae5f67130558958d43eb72070425a | |
parent | d344a107c64835954d494f2e4477c7326c31abd8 (diff) | |
download | chromium_src-cccd376dcdb2cc8855c7ca1fd649a948d68d6f08.zip chromium_src-cccd376dcdb2cc8855c7ca1fd649a948d68d6f08.tar.gz chromium_src-cccd376dcdb2cc8855c7ca1fd649a948d68d6f08.tar.bz2 |
Part 3 of reapplying r64637.
This moves SecurityStyle and PageType into chrome/common/ and removes the
chrome_frame dependency on chrome/browser/tab_contents/. This undoes the
temporary DEPS hack on chrome/common/.
BUG=51409
TEST=compiles
Review URL: http://codereview.chromium.org/4697005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65965 0039d316-1c4b-4281-b951-d872f2087c98
20 files changed, 64 insertions, 66 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 1b8b5b9..3dc5f6c 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -1354,7 +1354,7 @@ void TestingAutomationProvider::GetSecurityState(int handle, void TestingAutomationProvider::GetPageType( int handle, bool* success, - NavigationEntry::PageType* page_type) { + PageType* page_type) { if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); NavigationEntry* entry = tab->GetActiveEntry(); @@ -1362,12 +1362,12 @@ void TestingAutomationProvider::GetPageType( *success = true; // In order to return the proper result when an interstitial is shown and // no navigation entry were created for it we need to ask the TabContents. - if (*page_type == NavigationEntry::NORMAL_PAGE && + if (*page_type == NORMAL_PAGE && tab->tab_contents()->showing_interstitial_page()) - *page_type = NavigationEntry::INTERSTITIAL_PAGE; + *page_type = INTERSTITIAL_PAGE; } else { *success = false; - *page_type = NavigationEntry::NORMAL_PAGE; + *page_type = NORMAL_PAGE; } } @@ -1385,7 +1385,7 @@ void TestingAutomationProvider::ActionOnSSLBlockingPage( if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); NavigationEntry* entry = tab->GetActiveEntry(); - if (entry->page_type() == NavigationEntry::INTERSTITIAL_PAGE) { + if (entry->page_type() == INTERSTITIAL_PAGE) { TabContents* tab_contents = tab->tab_contents(); InterstitialPage* ssl_blocking_page = InterstitialPage::GetInterstitialPage(tab_contents); @@ -2469,10 +2469,10 @@ void TestingAutomationProvider::GetNavigationInfo( return_value->Set("ssl", ssl); // Page type. - std::map<NavigationEntry::PageType, std::string> pagetype_to_string; - pagetype_to_string[NavigationEntry::NORMAL_PAGE] = "NORMAL_PAGE"; - pagetype_to_string[NavigationEntry::ERROR_PAGE] = "ERROR_PAGE"; - pagetype_to_string[NavigationEntry::INTERSTITIAL_PAGE] = "INTERSTITIAL_PAGE"; + std::map<PageType, std::string> pagetype_to_string; + pagetype_to_string[NORMAL_PAGE] = "NORMAL_PAGE"; + pagetype_to_string[ERROR_PAGE] = "ERROR_PAGE"; + pagetype_to_string[INTERSTITIAL_PAGE] = "INTERSTITIAL_PAGE"; return_value->SetString("page_type", pagetype_to_string[nav_entry->page_type()]); diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 8cd999d..0e5ccaa 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -13,6 +13,7 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/sync/profile_sync_service_harness.h" #include "chrome/common/notification_registrar.h" +#include "chrome/common/page_type.h" class DictionaryValue; class TemplateURLModel; @@ -199,8 +200,7 @@ class TestingAutomationProvider : public AutomationProvider, int* insecure_content_status); // Gets the page type for the tab associated to the specified |handle|. - void GetPageType(int handle, bool* success, - NavigationEntry::PageType* page_type); + void GetPageType(int handle, bool* success, PageType* page_type); // Gets the duration in ms of the last event matching |event_name|. // |duration_ms| is -1 if the event hasn't occurred yet. diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 68665cf..1cd19e2 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -39,7 +39,7 @@ class SSLUITest : public InProcessBrowserTest { bool displayed_insecure_content) { NavigationEntry* entry = tab->controller().GetActiveEntry(); ASSERT_TRUE(entry); - EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry->page_type()); + EXPECT_EQ(NORMAL_PAGE, entry->page_type()); EXPECT_EQ(SECURITY_STYLE_AUTHENTICATED, entry->ssl().security_style()); EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); EXPECT_EQ(displayed_insecure_content, @@ -50,7 +50,7 @@ class SSLUITest : public InProcessBrowserTest { void CheckUnauthenticatedState(TabContents* tab) { NavigationEntry* entry = tab->controller().GetActiveEntry(); ASSERT_TRUE(entry); - EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry->page_type()); + EXPECT_EQ(NORMAL_PAGE, entry->page_type()); EXPECT_EQ(SECURITY_STYLE_UNAUTHENTICATED, entry->ssl().security_style()); EXPECT_EQ(0, entry->ssl().cert_status() & net::CERT_STATUS_ALL_ERRORS); EXPECT_FALSE(entry->ssl().displayed_insecure_content()); @@ -63,8 +63,7 @@ class SSLUITest : public InProcessBrowserTest { bool interstitial) { NavigationEntry* entry = tab->controller().GetActiveEntry(); ASSERT_TRUE(entry); - EXPECT_EQ(interstitial ? NavigationEntry::INTERSTITIAL_PAGE : - NavigationEntry::NORMAL_PAGE, + EXPECT_EQ(interstitial ? INTERSTITIAL_PAGE : NORMAL_PAGE, entry->page_type()); EXPECT_EQ(SECURITY_STYLE_AUTHENTICATION_BROKEN, entry->ssl().security_style()); diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc index ae1e078..8705e62 100644 --- a/chrome/browser/tab_contents/interstitial_page.cc +++ b/chrome/browser/tab_contents/interstitial_page.cc @@ -223,7 +223,7 @@ void InterstitialPage::Show() { NavigationEntry* entry = new NavigationEntry; entry->set_url(url_); entry->set_virtual_url(url_); - entry->set_page_type(NavigationEntry::INTERSTITIAL_PAGE); + entry->set_page_type(INTERSTITIAL_PAGE); // Give sub-classes a chance to set some states on the navigation entry. UpdateEntry(entry); diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index fc753c3..918a9b4 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -718,7 +718,7 @@ void NavigationController::RendererDidNavigateToNewPage( // Don't use the page type from the pending entry. Some interstitial page // may have set the type to interstitial. Once we commit, however, the page // type must always be normal. - new_entry->set_page_type(NavigationEntry::NORMAL_PAGE); + new_entry->set_page_type(NORMAL_PAGE); } else { new_entry = new NavigationEntry; } @@ -1200,8 +1200,7 @@ void NavigationController::InsertEntriesFrom( size_t insert_index = 0; for (int i = 0; i < max_index; i++) { // When cloning a tab, copy all entries except interstitial pages - if (source.entries_[i].get()->page_type() != - NavigationEntry::INTERSTITIAL_PAGE) { + if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { entries_.insert(entries_.begin() + insert_index++, linked_ptr<NavigationEntry>( new NavigationEntry(*source.entries_[i]))); diff --git a/chrome/browser/tab_contents/navigation_controller_unittest.cc b/chrome/browser/tab_contents/navigation_controller_unittest.cc index 8732b62..81010a9 100644 --- a/chrome/browser/tab_contents/navigation_controller_unittest.cc +++ b/chrome/browser/tab_contents/navigation_controller_unittest.cc @@ -1374,8 +1374,7 @@ TEST_F(NavigationControllerTest, Interstitial) { // Now navigate somewhere with an interstitial. const GURL url2("http://bar"); controller().LoadURL(url1, GURL(), PageTransition::TYPED); - controller().pending_entry()->set_page_type( - NavigationEntry::INTERSTITIAL_PAGE); + controller().pending_entry()->set_page_type(INTERSTITIAL_PAGE); // At this point the interstitial will be displayed and the load will still // be pending. If the user continues, the load will commit. @@ -1383,8 +1382,7 @@ TEST_F(NavigationControllerTest, Interstitial) { // The page should be a normal page again. EXPECT_EQ(url2, controller().GetLastCommittedEntry()->url()); - EXPECT_EQ(NavigationEntry::NORMAL_PAGE, - controller().GetLastCommittedEntry()->page_type()); + EXPECT_EQ(NORMAL_PAGE, controller().GetLastCommittedEntry()->page_type()); } TEST_F(NavigationControllerTest, RemoveEntry) { @@ -1674,7 +1672,7 @@ TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { // Add an interstitial entry. Should be deleted with controller. NavigationEntry* interstitial_entry = new NavigationEntry(); - interstitial_entry->set_page_type(NavigationEntry::INTERSTITIAL_PAGE); + interstitial_entry->set_page_type(INTERSTITIAL_PAGE); controller().AddTransientEntry(interstitial_entry); scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); diff --git a/chrome/browser/tab_contents/navigation_entry.h b/chrome/browser/tab_contents/navigation_entry.h index 9a5f6a5..ca97e02 100644 --- a/chrome/browser/tab_contents/navigation_entry.h +++ b/chrome/browser/tab_contents/navigation_entry.h @@ -10,8 +10,9 @@ #include "base/basictypes.h" #include "base/ref_counted.h" -#include "chrome/browser/tab_contents/security_style.h" +#include "chrome/common/page_type.h" #include "chrome/common/page_transition_types.h" +#include "chrome/common/security_style.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -132,13 +133,6 @@ class NavigationEntry { // Copy and assignment is explicitly allowed for this class. }; - // The type of the page an entry corresponds to. Used by tests. - enum PageType { - NORMAL_PAGE = 0, - ERROR_PAGE, - INTERSTITIAL_PAGE - }; - // Favicon ------------------------------------------------------------------- // Collects the favicon related information for a NavigationEntry. diff --git a/chrome/browser/tab_contents/navigation_entry_unittest.cc b/chrome/browser/tab_contents/navigation_entry_unittest.cc index db59464..e28cf1c 100644 --- a/chrome/browser/tab_contents/navigation_entry_unittest.cc +++ b/chrome/browser/tab_contents/navigation_entry_unittest.cc @@ -134,10 +134,10 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) { EXPECT_EQ(instance_, entry1_.get()->site_instance()); // Page type - EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry1_.get()->page_type()); - EXPECT_EQ(NavigationEntry::NORMAL_PAGE, entry2_.get()->page_type()); - entry2_.get()->set_page_type(NavigationEntry::INTERSTITIAL_PAGE); - EXPECT_EQ(NavigationEntry::INTERSTITIAL_PAGE, entry2_.get()->page_type()); + EXPECT_EQ(NORMAL_PAGE, entry1_.get()->page_type()); + EXPECT_EQ(NORMAL_PAGE, entry2_.get()->page_type()); + entry2_.get()->set_page_type(INTERSTITIAL_PAGE); + EXPECT_EQ(INTERSTITIAL_PAGE, entry2_.get()->page_type()); // Referrer EXPECT_EQ(GURL(), entry1_.get()->referrer()); diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 91995c7..6d6c575 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -685,7 +685,7 @@ bool TabContents::ShouldDisplayURL() { // Don't hide the url in view source mode and with interstitials. NavigationEntry* entry = controller_.GetActiveEntry(); if (entry && (entry->IsViewSourceMode() || - entry->page_type() == NavigationEntry::INTERSTITIAL_PAGE)) { + entry->page_type() == INTERSTITIAL_PAGE)) { return true; } diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 0cdca9a..bb21546 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2893,7 +2893,6 @@ 'browser/tab_contents/render_view_host_delegate_helper.h', 'browser/tab_contents/render_view_host_manager.cc', 'browser/tab_contents/render_view_host_manager.h', - 'browser/tab_contents/security_style.h', 'browser/tab_contents/tab_contents.cc', 'browser/tab_contents/tab_contents.h', 'browser/tab_contents/tab_contents_delegate.cc', diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 28924ca..89aeadc 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -271,6 +271,7 @@ 'common/native_web_keyboard_event_mac.mm', 'common/native_web_keyboard_event_win.cc', 'common/native_window_notification_source.h', + 'common/page_type.h', 'common/page_transition_types.cc', 'common/page_transition_types.h', 'common/page_zoom.h', @@ -294,6 +295,7 @@ 'common/resource_dispatcher.h', 'common/security_filter_peer.cc', 'common/security_filter_peer.h', + 'common/security_style.h', 'common/service_messages.cc', 'common/service_messages.h', 'common/service_messages_internal.h', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 1782ed1..46762ff 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -90,7 +90,6 @@ 'renderer/mock_render_thread.h', 'test/automation/autocomplete_edit_proxy.cc', 'test/automation/autocomplete_edit_proxy.h', - 'test/automation/automation_constants.h', 'test/automation/automation_handle_tracker.cc', 'test/automation/automation_handle_tracker.h', 'test/automation/automation_proxy.cc', diff --git a/chrome/common/DEPS b/chrome/common/DEPS index 26ce642..18175ac 100644 --- a/chrome/common/DEPS +++ b/chrome/common/DEPS @@ -17,15 +17,6 @@ include_rules = [ "+third_party/sqlite", "+third_party/zlib", - # TODO(erg): A previous version of this patch moved everything needed from - # tab_contents/ to chrome/common/ but failed on the buildbot (but not locally - # or on the trybots). Temporarily add this suppression as I commit what was a - # very large patch piecewise, removing it with the final patch that will move - # the files again and remove this override. - # - # (Also: the only thing used from these headers are enums.) - "+chrome/browser/tab_contents", - # FIXME - refactor code and remove these dependencies "+chrome/installer", ] diff --git a/chrome/common/automation_messages.h b/chrome/common/automation_messages.h index bc77704..0f8ec7c 100644 --- a/chrome/common/automation_messages.h +++ b/chrome/common/automation_messages.h @@ -11,8 +11,9 @@ #include "base/basictypes.h" #include "chrome/common/automation_constants.h" #include "chrome/common/common_param_traits.h" -#include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/security_style.h" +#include "chrome/common/page_type.h" +#include "chrome/common/security_style.h" +#include "chrome/common/common_param_traits.h" #include "gfx/rect.h" #include "net/base/upload_data.h" @@ -198,8 +199,8 @@ struct ParamTraits<SecurityStyle> { }; template <> -struct ParamTraits<NavigationEntry::PageType> { - typedef NavigationEntry::PageType param_type; +struct ParamTraits<PageType> { + typedef PageType param_type; static void Write(Message* m, const param_type& p) { m->WriteInt(p); } @@ -207,19 +208,19 @@ struct ParamTraits<NavigationEntry::PageType> { int type; if (!m->ReadInt(iter, &type)) return false; - *p = static_cast<NavigationEntry::PageType>(type); + *p = static_cast<PageType>(type); return true; } static void Log(const param_type& p, std::string* l) { std::string control; switch (p) { - case NavigationEntry::NORMAL_PAGE: + case NORMAL_PAGE: control = "NORMAL_PAGE"; break; - case NavigationEntry::ERROR_PAGE: + case ERROR_PAGE: control = "ERROR_PAGE"; break; - case NavigationEntry::INTERSTITIAL_PAGE: + case INTERSTITIAL_PAGE: control = "INTERSTITIAL_PAGE"; break; default: diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h index 97e0a20..15479f4 100644 --- a/chrome/common/automation_messages_internal.h +++ b/chrome/common/automation_messages_internal.h @@ -613,8 +613,7 @@ IPC_BEGIN_MESSAGES(Automation) // Response: // - bool: whether the operation was successful. // - PageType: the type of the page currently displayed. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetPageType, int, bool, - NavigationEntry::PageType) + IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_GetPageType, int, bool, PageType) // This message simulates the user action on the SSL blocking page showing in // the specified tab. This message is only effective if an interstitial page diff --git a/chrome/common/page_type.h b/chrome/common/page_type.h new file mode 100644 index 0000000..2a2bd1a --- /dev/null +++ b/chrome/common/page_type.h @@ -0,0 +1,17 @@ +// Copyright (c) 2009 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. + +#ifndef CHROME_COMMON_PAGE_TYPE_H_ +#define CHROME_COMMON_PAGE_TYPE_H_ +#pragma once + +// The type of the page an entry corresponds to. Used by chrome_frame and the +// automation layer to detect the state of a TabContents. +enum PageType { + NORMAL_PAGE = 0, + ERROR_PAGE, + INTERSTITIAL_PAGE +}; + +#endif // CHROME_COMMON_PAGE_TYPE_H_ diff --git a/chrome/browser/tab_contents/security_style.h b/chrome/common/security_style.h index 9694646..7d92d0e 100644 --- a/chrome/browser/tab_contents/security_style.h +++ b/chrome/common/security_style.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_TAB_CONTENTS_SECURITY_STYLE_H_ -#define CHROME_BROWSER_TAB_CONTENTS_SECURITY_STYLE_H_ +#ifndef CHROME_COMMON_SECURITY_STYLE_H_ +#define CHROME_COMMON_SECURITY_STYLE_H_ #pragma once // Various aspects of the UI change their appearance according to the security @@ -32,4 +32,4 @@ enum SecurityStyle { SECURITY_STYLE_AUTHENTICATED, }; -#endif // CHROME_BROWSER_TAB_CONTENTS_SECURITY_STYLE_H_ +#endif // CHROME_COMMON_SECURITY_STYLE_H_ diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index d7c99dd..fbd837c 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -605,7 +605,7 @@ bool TabProxy::GetSecurityState(SecurityStyle* security_style, return succeeded; } -bool TabProxy::GetPageType(NavigationEntry::PageType* type) { +bool TabProxy::GetPageType(PageType* type) { DCHECK(type); if (!is_valid()) diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 217863c..c4b1ee7 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -18,9 +18,9 @@ #include "base/compiler_specific.h" #include "base/observer_list.h" #include "chrome/browser/download/save_package.h" -#include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/security_style.h" #include "chrome/common/automation_constants.h" +#include "chrome/common/page_type.h" +#include "chrome/common/security_style.h" #include "chrome/test/automation/automation_handle_tracker.h" #include "chrome/test/automation/dom_element_proxy.h" #include "chrome/test/automation/javascript_execution_controller.h" @@ -323,7 +323,7 @@ class TabProxy : public AutomationResourceProxy, // Returns the type of the page currently showing (normal, interstitial, // error). - bool GetPageType(NavigationEntry::PageType* page_type) WARN_UNUSED_RESULT; + bool GetPageType(PageType* page_type) WARN_UNUSED_RESULT; // Simulates the user action on the SSL blocking page. if |proceed| is true, // this is equivalent to clicking the 'Proceed' button, if false to 'Take me diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc index dd3faaa..fdb81dfe 100644 --- a/chrome_frame/chrome_active_document.cc +++ b/chrome_frame/chrome_active_document.cc @@ -31,7 +31,7 @@ #include "base/win/scoped_variant.h" #include "grit/generated_resources.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/app/chrome_dll_resource.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/navigation_types.h" #include "chrome/common/page_zoom.h" |