summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/tab_contents/navigation_controller.cc35
-rw-r--r--content/browser/tab_contents/navigation_controller.h4
-rw-r--r--content/browser/tab_contents/navigation_controller_unittest.cc6
-rw-r--r--content/browser/tab_contents/navigation_details.cc2
-rw-r--r--content/browser/tab_contents/navigation_details.h4
-rw-r--r--content/browser/tab_contents/tab_contents.cc4
-rw-r--r--content/browser/tab_contents/tab_contents_delegate.cc2
-rw-r--r--content/browser/tab_contents/tab_contents_delegate.h4
-rw-r--r--content/common/navigation_types.h67
-rw-r--r--content/content_browser.gypi1
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/public/browser/navigation_types.h60
12 files changed, 91 insertions, 99 deletions
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index f46b5d4..9c926a0 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -21,7 +21,6 @@
#include "content/browser/tab_contents/tab_contents_delegate.h"
#include "content/browser/user_metrics.h"
#include "content/common/content_constants.h"
-#include "content/common/navigation_types.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
#include "content/public/browser/notification_types.h"
@@ -557,26 +556,26 @@ bool NavigationController::RendererDidNavigate(
details->type = ClassifyNavigation(params);
switch (details->type) {
- case NavigationType::NEW_PAGE:
+ case content::NAVIGATION_TYPE_NEW_PAGE:
RendererDidNavigateToNewPage(params, &(details->did_replace_entry));
break;
- case NavigationType::EXISTING_PAGE:
+ case content::NAVIGATION_TYPE_EXISTING_PAGE:
RendererDidNavigateToExistingPage(params);
break;
- case NavigationType::SAME_PAGE:
+ case content::NAVIGATION_TYPE_SAME_PAGE:
RendererDidNavigateToSamePage(params);
break;
- case NavigationType::IN_PAGE:
+ case content::NAVIGATION_TYPE_IN_PAGE:
RendererDidNavigateInPage(params, &(details->did_replace_entry));
break;
- case NavigationType::NEW_SUBFRAME:
+ case content::NAVIGATION_TYPE_NEW_SUBFRAME:
RendererDidNavigateNewSubframe(params);
break;
- case NavigationType::AUTO_SUBFRAME:
+ case content::NAVIGATION_TYPE_AUTO_SUBFRAME:
if (!RendererDidNavigateAutoSubframe(params))
return false;
break;
- case NavigationType::NAV_IGNORE:
+ case content::NAVIGATION_TYPE_NAV_IGNORE:
// If a pending navigation was in progress, this canceled it. We should
// discard it and make sure it is removed from the URL bar. After that,
// there is nothing we can do with this navigation, so we just return to
@@ -615,7 +614,7 @@ bool NavigationController::RendererDidNavigate(
return true;
}
-NavigationType::Type NavigationController::ClassifyNavigation(
+content::NavigationType NavigationController::ClassifyNavigation(
const ViewHostMsg_FrameNavigate_Params& params) const {
if (params.page_id == -1) {
// The renderer generates the page IDs, and so if it gives us the invalid
@@ -636,7 +635,7 @@ NavigationType::Type NavigationController::ClassifyNavigation(
// list.
//
// In these cases, there's nothing we can do with them, so ignore.
- return NavigationType::NAV_IGNORE;
+ return content::NAVIGATION_TYPE_NAV_IGNORE;
}
if (params.page_id > tab_contents_->GetMaxPageID()) {
@@ -644,7 +643,7 @@ NavigationType::Type NavigationController::ClassifyNavigation(
// not have a pending entry for the page, and this may or may not be the
// main frame.
if (content::PageTransitionIsMainFrame(params.transition))
- return NavigationType::NEW_PAGE;
+ return content::NAVIGATION_TYPE_NEW_PAGE;
// When this is a new subframe navigation, we should have a committed page
// for which it's a suframe in. This may not be the case when an iframe is
@@ -652,10 +651,10 @@ NavigationType::Type NavigationController::ClassifyNavigation(
// written into the popup by script on the main page). For these cases,
// there isn't any navigation stuff we can do, so just ignore it.
if (!GetLastCommittedEntry())
- return NavigationType::NAV_IGNORE;
+ return content::NAVIGATION_TYPE_NAV_IGNORE;
// Valid subframe navigation.
- return NavigationType::NEW_SUBFRAME;
+ return content::NAVIGATION_TYPE_NEW_SUBFRAME;
}
// Now we know that the notification is for an existing page. Find that entry.
@@ -674,7 +673,7 @@ NavigationType::Type NavigationController::ClassifyNavigation(
UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_NC"));
if (tab_contents_->GetSiteInstance()->HasProcess())
tab_contents_->GetSiteInstance()->GetProcess()->ReceivedBadMessage();
- return NavigationType::NAV_IGNORE;
+ return content::NAVIGATION_TYPE_NAV_IGNORE;
}
NavigationEntry* existing_entry = entries_[existing_entry_index].get();
@@ -683,7 +682,7 @@ NavigationType::Type NavigationController::ClassifyNavigation(
// know this is auto. Since the current page was found in the navigation
// entry list, we're guaranteed to have a last committed entry.
DCHECK(GetLastCommittedEntry());
- return NavigationType::AUTO_SUBFRAME;
+ return content::NAVIGATION_TYPE_AUTO_SUBFRAME;
}
// Anything below here we know is a main frame navigation.
@@ -698,7 +697,7 @@ NavigationType::Type NavigationController::ClassifyNavigation(
// (the user doesn't want to have a new back/forward entry when they do
// this). If this matches the last committed entry, we want to just ignore
// the pending entry and go back to where we were (the "existing entry").
- return NavigationType::SAME_PAGE;
+ return content::NAVIGATION_TYPE_SAME_PAGE;
}
// Any toplevel navigations with the same base (minus the reference fragment)
@@ -707,11 +706,11 @@ NavigationType::Type NavigationController::ClassifyNavigation(
// navigations that don't actually navigate, but it can happen when there is
// an encoding override (it always sends a navigation request).
if (AreURLsInPageNavigation(existing_entry->url(), params.url))
- return NavigationType::IN_PAGE;
+ return content::NAVIGATION_TYPE_IN_PAGE;
// Since we weeded out "new" navigations above, we know this is an existing
// (back/forward) navigation.
- return NavigationType::EXISTING_PAGE;
+ return content::NAVIGATION_TYPE_EXISTING_PAGE;
}
bool NavigationController::IsRedirect(
diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h
index 7127057..e9bc0d3 100644
--- a/content/browser/tab_contents/navigation_controller.h
+++ b/content/browser/tab_contents/navigation_controller.h
@@ -16,7 +16,7 @@
#include "googleurl/src/gurl.h"
#include "content/browser/ssl/ssl_manager.h"
#include "content/common/content_export.h"
-#include "content/common/navigation_types.h"
+#include "content/public/browser/navigation_types.h"
#include "content/public/common/page_transition_types.h"
class NavigationEntry;
@@ -348,7 +348,7 @@ class CONTENT_EXPORT NavigationController {
friend class TabContents; // For invoking OnReservedPageIDRange.
// Classifies the given renderer navigation (see the NavigationType enum).
- NavigationType::Type ClassifyNavigation(
+ content::NavigationType ClassifyNavigation(
const ViewHostMsg_FrameNavigate_Params& params) const;
// Causes the controller to load the specified entry. The function assumes
diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc
index d897748..3ef5f39 100644
--- a/content/browser/tab_contents/navigation_controller_unittest.cc
+++ b/content/browser/tab_contents/navigation_controller_unittest.cc
@@ -889,7 +889,7 @@ TEST_F(NavigationControllerTest, Redirect) {
EXPECT_TRUE(notifications.Check1AndReset(
content::NOTIFICATION_NAV_ENTRY_COMMITTED));
- EXPECT_TRUE(details.type == NavigationType::SAME_PAGE);
+ EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_SAME_PAGE);
EXPECT_EQ(controller().entry_count(), 1);
EXPECT_EQ(controller().last_committed_entry_index(), 0);
EXPECT_TRUE(controller().GetLastCommittedEntry());
@@ -947,7 +947,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) {
EXPECT_TRUE(notifications.Check1AndReset(
content::NOTIFICATION_NAV_ENTRY_COMMITTED));
- EXPECT_TRUE(details.type == NavigationType::SAME_PAGE);
+ EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_SAME_PAGE);
EXPECT_EQ(controller().entry_count(), 1);
EXPECT_EQ(controller().last_committed_entry_index(), 0);
EXPECT_TRUE(controller().GetLastCommittedEntry());
@@ -994,7 +994,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) {
EXPECT_TRUE(notifications.Check1AndReset(
content::NOTIFICATION_NAV_ENTRY_COMMITTED));
- EXPECT_TRUE(details.type == NavigationType::NEW_PAGE);
+ EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_NEW_PAGE);
EXPECT_EQ(controller().entry_count(), 1);
EXPECT_EQ(controller().last_committed_entry_index(), 0);
EXPECT_TRUE(controller().GetLastCommittedEntry());
diff --git a/content/browser/tab_contents/navigation_details.cc b/content/browser/tab_contents/navigation_details.cc
index ad44208..1709f31 100644
--- a/content/browser/tab_contents/navigation_details.cc
+++ b/content/browser/tab_contents/navigation_details.cc
@@ -8,7 +8,7 @@ namespace content {
LoadCommittedDetails::LoadCommittedDetails()
: entry(NULL),
- type(NavigationType::UNKNOWN),
+ type(content::NAVIGATION_TYPE_UNKNOWN),
previous_entry_index(-1),
did_replace_entry(false),
is_in_page(false),
diff --git a/content/browser/tab_contents/navigation_details.h b/content/browser/tab_contents/navigation_details.h
index 7ed97ae..b43e72d 100644
--- a/content/browser/tab_contents/navigation_details.h
+++ b/content/browser/tab_contents/navigation_details.h
@@ -7,8 +7,8 @@
#pragma once
#include <string>
-#include "content/common/navigation_types.h"
#include "content/common/content_export.h"
+#include "content/public/browser/navigation_types.h"
#include "googleurl/src/gurl.h"
class NavigationEntry;
@@ -30,7 +30,7 @@ struct CONTENT_EXPORT LoadCommittedDetails {
// The type of navigation that just occurred. Note that not all types of
// navigations in the enum are valid here, since some of them don't actually
// cause a "commit" and won't generate this notification.
- NavigationType::Type type;
+ content::NavigationType type;
// The index of the previously committed navigation entry. This will be -1
// if there are no previous entries.
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 35951e4..6e70c65 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -43,9 +43,9 @@
#include "content/common/content_constants.h"
#include "content/common/content_restriction.h"
#include "content/common/intents_messages.h"
-#include "content/common/navigation_types.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
+#include "content/public/browser/navigation_types.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/view_types.h"
@@ -1500,7 +1500,7 @@ void TabContents::DidNavigate(RenderViewHost* rvh,
// Send notification about committed provisional loads. This notification is
// different from the NAV_ENTRY_COMMITTED notification which doesn't include
// the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations.
- if (details.type != NavigationType::NAV_IGNORE) {
+ if (details.type != content::NAVIGATION_TYPE_NAV_IGNORE) {
// For AUTO_SUBFRAME navigations, an event for the main frame is generated
// that is not recorded in the navigation history. For the purpose of
// tracking navigation events, we treat this event as a sub frame navigation
diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc
index 723775d..e25f8b6 100644
--- a/content/browser/tab_contents/tab_contents_delegate.cc
+++ b/content/browser/tab_contents/tab_contents_delegate.cc
@@ -205,7 +205,7 @@ bool TabContentsDelegate::OnGoToEntryOffset(int offset) {
bool TabContentsDelegate::ShouldAddNavigationToHistory(
const history::HistoryAddPageArgs& add_page_args,
- NavigationType::Type navigation_type) {
+ content::NavigationType navigation_type) {
return true;
}
diff --git a/content/browser/tab_contents/tab_contents_delegate.h b/content/browser/tab_contents/tab_contents_delegate.h
index 43ddf6a..f64dfff 100644
--- a/content/browser/tab_contents/tab_contents_delegate.h
+++ b/content/browser/tab_contents/tab_contents_delegate.h
@@ -12,7 +12,7 @@
#include "base/basictypes.h"
#include "content/browser/tab_contents/navigation_entry.h"
#include "content/common/content_export.h"
-#include "content/common/navigation_types.h"
+#include "content/public/browser/navigation_types.h"
#include "content/public/common/page_transition_types.h"
#include "ui/gfx/native_widget_types.h"
#include "webkit/glue/window_open_disposition.h"
@@ -259,7 +259,7 @@ class CONTENT_EXPORT TabContentsDelegate {
// history.
virtual bool ShouldAddNavigationToHistory(
const history::HistoryAddPageArgs& add_page_args,
- NavigationType::Type navigation_type);
+ content::NavigationType navigation_type);
// Returns the native window framing the view containing the tab contents.
virtual gfx::NativeWindow GetFrameNativeWindow();
diff --git a/content/common/navigation_types.h b/content/common/navigation_types.h
deleted file mode 100644
index bff569d..0000000
--- a/content/common/navigation_types.h
+++ /dev/null
@@ -1,67 +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 CONTENT_COMMON_NAVIGATION_TYPES_H_
-#define CONTENT_COMMON_NAVIGATION_TYPES_H_
-#pragma once
-
-#include "base/basictypes.h"
-
-// Indicates different types of navigations that can occur that we will handle
-// separately.
-class NavigationType {
- public:
- enum Type {
- // Unknown type.
- UNKNOWN,
-
- // A new page was navigated in the main frame.
- NEW_PAGE,
-
- // Renavigating to an existing navigation entry. The entry is guaranteed to
- // exist in the list, or else it would be a new page or IGNORE navigation.
- EXISTING_PAGE,
-
- // The same page has been reloaded as a result of the user requesting
- // navigation to that same page (like pressing Enter in the URL bar). This
- // is not the same as an in-page navigation because we'll actually have a
- // pending entry for the load, which is then meaningless.
- SAME_PAGE,
-
- // In page navigations are when the reference fragment changes. This will
- // be in the main frame only (we won't even get notified of in-page
- // subframe navigations). It may be for any page, not necessarily the last
- // committed one (for example, whey going back to a page with a ref).
- IN_PAGE,
-
- // A new subframe was manually navigated by the user. We will create a new
- // NavigationEntry so they can go back to the previous subframe content
- // using the back button.
- NEW_SUBFRAME,
-
- // A subframe in the page was automatically loaded or navigated to such that
- // a new navigation entry should not be created. There are two cases:
- // 1. Stuff like iframes containing ads that the page loads automatically.
- // The user doesn't want to see these, so we just update the existing
- // navigation entry.
- // 2. Going back/forward to previous subframe navigations. We don't create
- // a new entry here either, just update the last committed entry.
- // These two cases are actually pretty different, they just happen to
- // require almost the same code to handle.
- AUTO_SUBFRAME,
-
- // Nothing happened. This happens when we get information about a page we
- // don't know anything about. It can also happen when an iframe in a popup
- // navigated to about:blank is navigated. Nothing needs to be done.
- NAV_IGNORE,
- };
-
- private:
- // This class is for scoping only, so you shouldn't create an instance of it.
- NavigationType() {}
-
- DISALLOW_COPY_AND_ASSIGN(NavigationType);
-};
-
-#endif // CONTENT_COMMON_NAVIGATION_TYPES_H_
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 973cbc6..5977a39 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -559,6 +559,7 @@
'browser/zygote_host_linux.h',
'browser/zygote_main_linux.cc',
'public/browser/native_web_keyboard_event.h',
+ 'public/browser/navigation_types.h',
'public/browser/notification_types.h',
],
'conditions': [
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 0b22e3d..36de997 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -159,7 +159,6 @@
'common/message_router.h',
'common/mime_registry_messages.h',
'common/navigation_gesture.h',
- 'common/navigation_types.h',
'common/net/url_fetcher.cc',
'common/net/url_fetcher.h',
'common/notification_details.cc',
diff --git a/content/public/browser/navigation_types.h b/content/public/browser/navigation_types.h
new file mode 100644
index 0000000..4ce04b8
--- /dev/null
+++ b/content/public/browser/navigation_types.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2011 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 CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPES_H_
+#define CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPES_H_
+#pragma once
+
+namespace content {
+
+// Indicates different types of navigations that can occur that we will handle
+// separately.
+enum NavigationType {
+ // Unknown type.
+ NAVIGATION_TYPE_UNKNOWN,
+
+ // A new page was navigated in the main frame.
+ NAVIGATION_TYPE_NEW_PAGE,
+
+ // Renavigating to an existing navigation entry. The entry is guaranteed to
+ // exist in the list, or else it would be a new page or IGNORE navigation.
+ NAVIGATION_TYPE_EXISTING_PAGE,
+
+ // The same page has been reloaded as a result of the user requesting
+ // navigation to that same page (like pressing Enter in the URL bar). This
+ // is not the same as an in-page navigation because we'll actually have a
+ // pending entry for the load, which is then meaningless.
+ NAVIGATION_TYPE_SAME_PAGE,
+
+ // In page navigations are when the reference fragment changes. This will
+ // be in the main frame only (we won't even get notified of in-page
+ // subframe navigations). It may be for any page, not necessarily the last
+ // committed one (for example, whey going back to a page with a ref).
+ NAVIGATION_TYPE_IN_PAGE,
+
+ // A new subframe was manually navigated by the user. We will create a new
+ // NavigationEntry so they can go back to the previous subframe content
+ // using the back button.
+ NAVIGATION_TYPE_NEW_SUBFRAME,
+
+ // A subframe in the page was automatically loaded or navigated to such that
+ // a new navigation entry should not be created. There are two cases:
+ // 1. Stuff like iframes containing ads that the page loads automatically.
+ // The user doesn't want to see these, so we just update the existing
+ // navigation entry.
+ // 2. Going back/forward to previous subframe navigations. We don't create
+ // a new entry here either, just update the last committed entry.
+ // These two cases are actually pretty different, they just happen to
+ // require almost the same code to handle.
+ NAVIGATION_TYPE_AUTO_SUBFRAME,
+
+ // Nothing happened. This happens when we get information about a page we
+ // don't know anything about. It can also happen when an iframe in a popup
+ // navigated to about:blank is navigated. Nothing needs to be done.
+ NAVIGATION_TYPE_NAV_IGNORE,
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_TYPES_H_