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 /chrome/browser | |
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
Diffstat (limited to 'chrome/browser')
10 files changed, 27 insertions, 72 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/security_style.h b/chrome/browser/tab_contents/security_style.h deleted file mode 100644 index 9694646..0000000 --- a/chrome/browser/tab_contents/security_style.h +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -#ifndef CHROME_BROWSER_TAB_CONTENTS_SECURITY_STYLE_H_ -#define CHROME_BROWSER_TAB_CONTENTS_SECURITY_STYLE_H_ -#pragma once - -// Various aspects of the UI change their appearance according to the security -// context in which they are displayed. For example, the location bar displays -// a lock icon when it is displayed during a valid SSL connection. -// SecuirtySyle enumerates these styles, but it is up to the UI elements to -// adjust their display appropriately. -enum SecurityStyle { - // SECURITY_STYLE_UNKNOWN indicates that we do not know the proper security - // style for this object. - SECURITY_STYLE_UNKNOWN, - - // SECURITY_STYLE_UNAUTHENTICATED means the authenticity of this object can - // not be determined, either because it was retrieved using an unauthenticated - // protocol, such as HTTP or FTP, or it was retrieved using a protocol that - // supports authentication, such as HTTPS, but there were errors during - // transmission that render us uncertain to the object's authenticity. - SECURITY_STYLE_UNAUTHENTICATED, - - // SECURITY_STYLE_AUTHENTICATION_BROKEN indicates that we tried to retrieve - // this object in an authenticated manner but were unable to do so. - SECURITY_STYLE_AUTHENTICATION_BROKEN, - - // SECURITY_STYLE_AUTHENTICATED indicates that we successfully retrieved this - // object over an authenticated protocol, such as HTTPS. - SECURITY_STYLE_AUTHENTICATED, -}; - -#endif // CHROME_BROWSER_TAB_CONTENTS_SECURITY_STYLE_H_ 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; } |