summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-16 05:32:40 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-16 05:32:40 +0000
commitec8879e8fa012a7c8825ebec40650551b73cd786 (patch)
tree0e15ea2b4235799523c47d186251e2daa75821df /content
parentf5e30253a2a8062a87a0b784a302145e96ec1916 (diff)
downloadchromium_src-ec8879e8fa012a7c8825ebec40650551b73cd786.zip
chromium_src-ec8879e8fa012a7c8825ebec40650551b73cd786.tar.gz
chromium_src-ec8879e8fa012a7c8825ebec40650551b73cd786.tar.bz2
Generate PageTransitionTypes.java for Android
BUG= Review URL: https://codereview.chromium.org/11577016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/content.gyp13
-rw-r--r--content/content_common.gypi1
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentView.java12
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java9
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java6
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/PageTransitionTypes.template12
-rw-r--r--content/public/common/page_transition_types.h127
-rw-r--r--content/public/common/page_transition_types_list.h130
8 files changed, 180 insertions, 130 deletions
diff --git a/content/content.gyp b/content/content.gyp
index e847463..3863849 100644
--- a/content/content.gyp
+++ b/content/content.gyp
@@ -287,6 +287,7 @@
'../ui/ui.gyp:ui_java',
'common_aidl',
'content_common',
+ 'page_transition_types_java',
],
'variables': {
'package_name': 'content',
@@ -305,6 +306,18 @@
'includes': [ '../build/java.gypi' ],
},
{
+ 'target_name': 'page_transition_types_java',
+ 'type': 'none',
+ 'sources': [
+ 'public/common/page_transition_types_list.h',
+ 'public/android/java/src/org/chromium/content/browser/PageTransitionTypes.template',
+ ],
+ 'variables': {
+ 'package_name': 'org.chromium.content.browser',
+ },
+ 'includes': [ '../build/android/java_cpp_template.gypi' ],
+ },
+ {
'target_name': 'surface_texture_jni_headers',
'type': 'none',
'variables': {
diff --git a/content/content_common.gypi b/content/content_common.gypi
index d046368..56158a6 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -63,6 +63,7 @@
'public/common/media_stream_request.h',
'public/common/page_transition_types.cc',
'public/common/page_transition_types.h',
+ 'public/common/page_transition_types_list.h',
'public/common/page_type.h',
'public/common/page_zoom.h',
'public/common/password_form.cc',
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentView.java b/content/public/android/java/src/org/chromium/content/browser/ContentView.java
index ea72eea..3b9bd82 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentView.java
@@ -34,13 +34,19 @@ import java.util.ArrayList;
* compatibility.
*/
public class ContentView extends FrameLayout implements ContentViewCore.InternalAccessDelegate {
-
- // The following constants match the ones in chrome/common/page_transition_types.h.
- // Add more if you need them.
+ // Use PageTransitionLink class instead.
+ // TODO(boliu): Remove these.
+ @Deprecated
public static final int PAGE_TRANSITION_LINK = 0;
+ @Deprecated
public static final int PAGE_TRANSITION_TYPED = 1;
+ @Deprecated
public static final int PAGE_TRANSITION_AUTO_BOOKMARK = 2;
+ @Deprecated
public static final int PAGE_TRANSITION_GENERATED = 5;
+
+ // TODO(boliu): This diverged from native. Fix this.
+ @Deprecated
public static final int PAGE_TRANSITION_START_PAGE = 6;
// Flag that should be ORed to the page transition when a navigation is initiated from the
// omnibox.
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 17449f3..be4a427 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -58,12 +58,17 @@ import java.lang.annotation.Annotation;
public class ContentViewCore implements MotionEventDelegate {
private static final String TAG = ContentViewCore.class.getName();
- // The following constants match the ones in content/public/common/page_transition_types.h
- // Add more if you need them.
+ // Use PageTransitionLink class instead.
+ // TODO(boliu): Remove these.
+ @Deprecated
public static final int PAGE_TRANSITION_LINK = 0;
+ @Deprecated
public static final int PAGE_TRANSITION_TYPED = 1;
+ @Deprecated
public static final int PAGE_TRANSITION_AUTO_BOOKMARK = 2;
+ @Deprecated
public static final int PAGE_TRANSITION_START_PAGE = 6;
+ @Deprecated
public static final int PAGE_TRANSITION_RELOAD = 8;
// Used when ContentView implements a standalone View.
diff --git a/content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java b/content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java
index 24d153f..fa831aa 100644
--- a/content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java
+++ b/content/public/android/java/src/org/chromium/content/browser/LoadUrlParams.java
@@ -49,7 +49,7 @@ public class LoadUrlParams {
mUrl = url;
mLoadUrlType = LOAD_TYPE_DEFAULT;
- mTransitionType = ContentViewCore.PAGE_TRANSITION_LINK;
+ mTransitionType = PageTransitionTypes.PAGE_TRANSITION_LINK;
mUaOverrideOption = UA_OVERRIDE_INHERIT;
mPostData = null;
mBaseUrlForDataUrl = null;
@@ -74,7 +74,7 @@ public class LoadUrlParams {
LoadUrlParams params = new LoadUrlParams(dataUrl.toString());
params.setLoadType(LoadUrlParams.LOAD_TYPE_DATA);
- params.setTransitionType(ContentViewCore.PAGE_TRANSITION_TYPED);
+ params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_TYPED);
return params;
}
@@ -114,7 +114,7 @@ public class LoadUrlParams {
String url, byte[] postData) {
LoadUrlParams params = new LoadUrlParams(url);
params.setLoadType(LOAD_TYPE_BROWSER_INITIATED_HTTP_POST);
- params.setTransitionType(ContentViewCore.PAGE_TRANSITION_TYPED);
+ params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_TYPED);
params.setPostData(postData);
return params;
}
diff --git a/content/public/android/java/src/org/chromium/content/browser/PageTransitionTypes.template b/content/public/android/java/src/org/chromium/content/browser/PageTransitionTypes.template
new file mode 100644
index 0000000..f9c96b9
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/PageTransitionTypes.template
@@ -0,0 +1,12 @@
+// Copyright (c) 2012 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.
+
+package org.chromium.content.browser;
+
+public class PageTransitionTypes {
+#define PAGE_TRANSITION(label, value) public static final int \
+ PAGE_TRANSITION_ ## label = value;
+#include "content/public/common/page_transition_types_list.h"
+#undef PAGE_TRANSITION
+}
diff --git a/content/public/common/page_transition_types.h b/content/public/common/page_transition_types.h
index 7c46b79..3e6c454 100644
--- a/content/public/common/page_transition_types.h
+++ b/content/public/common/page_transition_types.h
@@ -10,129 +10,12 @@
namespace content {
-// Types of transitions between pages. These are stored in the history
-// database to separate visits, and are reported by the renderer for page
-// navigations.
-//
-// WARNING: don't change these numbers. They are written directly into the
-// history database, so future versions will need the same values to match
-// the enums.
-//
-// A type is made of a core value and a set of qualifiers. A type has one
-// core value and 0 or or more qualifiers.
enum PageTransition {
- // User got to this page by clicking a link on another page.
- PAGE_TRANSITION_LINK = 0,
-
- // User got this page by typing the URL in the URL bar. This should not be
- // used for cases where the user selected a choice that didn't look at all
- // like a URL; see GENERATED below.
- //
- // We also use this for other "explicit" navigation actions.
- PAGE_TRANSITION_TYPED = 1,
-
- // User got to this page through a suggestion in the UI, for example,
- // through the destinations page.
- PAGE_TRANSITION_AUTO_BOOKMARK = 2,
-
- // This is a subframe navigation. This is any content that is automatically
- // loaded in a non-toplevel frame. For example, if a page consists of
- // several frames containing ads, those ad URLs will have this transition
- // type. The user may not even realize the content in these pages is a
- // separate frame, so may not care about the URL (see MANUAL below).
- PAGE_TRANSITION_AUTO_SUBFRAME = 3,
-
- // For subframe navigations that are explicitly requested by the user and
- // generate new navigation entries in the back/forward list. These are
- // probably more important than frames that were automatically loaded in
- // the background because the user probably cares about the fact that this
- // link was loaded.
- PAGE_TRANSITION_MANUAL_SUBFRAME = 4,
-
- // User got to this page by typing in the URL bar and selecting an entry
- // that did not look like a URL. For example, a match might have the URL
- // of a Google search result page, but appear like "Search Google for ...".
- // These are not quite the same as TYPED navigations because the user
- // didn't type or see the destination URL.
- // See also KEYWORD.
- PAGE_TRANSITION_GENERATED = 5,
-
- // This is a toplevel navigation. This is any content that is automatically
- // loaded in a toplevel frame. For example, opening a tab to show the ASH
- // screen saver, opening the devtools window, opening the NTP after the safe
- // browsing warning, opening web-based dialog boxes are examples of
- // AUTO_TOPLEVEL navigations.
- PAGE_TRANSITION_AUTO_TOPLEVEL = 6,
-
- // The user filled out values in a form and submitted it. NOTE that in
- // some situations submitting a form does not result in this transition
- // type. This can happen if the form uses script to submit the contents.
- PAGE_TRANSITION_FORM_SUBMIT = 7,
-
- // The user "reloaded" the page, either by hitting the reload button or by
- // hitting enter in the address bar. NOTE: This is distinct from the
- // concept of whether a particular load uses "reload semantics" (i.e.
- // bypasses cached data). For this reason, lots of code needs to pass
- // around the concept of whether a load should be treated as a "reload"
- // separately from their tracking of this transition type, which is mainly
- // used for proper scoring for consumers who care about how frequently a
- // user typed/visited a particular URL.
- //
- // SessionRestore and undo tab close use this transition type too.
- PAGE_TRANSITION_RELOAD = 8,
-
- // The url was generated from a replaceable keyword other than the default
- // search provider. If the user types a keyword (which also applies to
- // tab-to-search) in the omnibox this qualifier is applied to the transition
- // type of the generated url. TemplateURLModel then may generate an
- // additional visit with a transition type of KEYWORD_GENERATED against the
- // url 'http://' + keyword. For example, if you do a tab-to-search against
- // wikipedia the generated url has a transition qualifer of KEYWORD, and
- // TemplateURLModel generates a visit for 'wikipedia.org' with a transition
- // type of KEYWORD_GENERATED.
- PAGE_TRANSITION_KEYWORD = 9,
-
- // Corresponds to a visit generated for a keyword. See description of
- // KEYWORD for more details.
- PAGE_TRANSITION_KEYWORD_GENERATED = 10,
-
- // ADDING NEW CORE VALUE? Be sure to update the LAST_CORE and CORE_MASK
- // values below. Also update CoreTransitionString().
- PAGE_TRANSITION_LAST_CORE = PAGE_TRANSITION_KEYWORD_GENERATED,
- PAGE_TRANSITION_CORE_MASK = 0xFF,
-
- // Qualifiers
- // Any of the core values above can be augmented by one or more qualifiers.
- // These qualifiers further define the transition.
-
- // User used the Forward or Back button to navigate among browsing history.
- PAGE_TRANSITION_FORWARD_BACK = 0x01000000,
-
- // User used the address bar to trigger this navigation.
- PAGE_TRANSITION_FROM_ADDRESS_BAR = 0x02000000,
-
- // User is navigating to the home page.
- PAGE_TRANSITION_HOME_PAGE = 0x04000000,
-
- // The beginning of a navigation chain.
- PAGE_TRANSITION_CHAIN_START = 0x10000000,
-
- // The last transition in a redirect chain.
- PAGE_TRANSITION_CHAIN_END = 0x20000000,
-
- // Redirects caused by JavaScript or a meta refresh tag on the page.
- PAGE_TRANSITION_CLIENT_REDIRECT = 0x40000000,
-
- // Redirects sent from the server by HTTP headers. It might be nice to
- // break this out into 2 types in the future, permanent or temporary, if we
- // can get that information from WebKit.
- PAGE_TRANSITION_SERVER_REDIRECT = 0x80000000,
-
- // Used to test whether a transition involves a redirect.
- PAGE_TRANSITION_IS_REDIRECT_MASK = 0xC0000000,
-
- // General mask defining the bits used for the qualifiers.
- PAGE_TRANSITION_QUALIFIER_MASK = 0xFFFFFF00
+
+#define PAGE_TRANSITION(label, value) PAGE_TRANSITION_ ## label = value,
+#include "content/public/common/page_transition_types_list.h"
+#undef PAGE_TRANSITION
+
};
// Simplifies the provided transition by removing any qualifier
diff --git a/content/public/common/page_transition_types_list.h b/content/public/common/page_transition_types_list.h
new file mode 100644
index 0000000..8a5bc76
--- /dev/null
+++ b/content/public/common/page_transition_types_list.h
@@ -0,0 +1,130 @@
+// Copyright (c) 2012 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.
+
+// Intentionally no include guards because this file is meant to be included
+// inside a macro to generate enum values.
+
+// Types of transitions between pages. These are stored in the history
+// database to separate visits, and are reported by the renderer for page
+// navigations.
+//
+// WARNING: don't change these numbers. They are written directly into the
+// history database, so future versions will need the same values to match
+// the enums.
+//
+// A type is made of a core value and a set of qualifiers. A type has one
+// core value and 0 or or more qualifiers.
+
+// User got to this page by clicking a link on another page.
+PAGE_TRANSITION(LINK, 0)
+
+// User got this page by typing the URL in the URL bar. This should not be
+// used for cases where the user selected a choice that didn't look at all
+// like a URL; see GENERATED below.
+//
+// We also use this for other "explicit" navigation actions.
+PAGE_TRANSITION(TYPED, 1)
+
+// User got to this page through a suggestion in the UI, for example)
+// through the destinations page.
+PAGE_TRANSITION(AUTO_BOOKMARK, 2)
+
+// This is a subframe navigation. This is any content that is automatically
+// loaded in a non-toplevel frame. For example, if a page consists of
+// several frames containing ads, those ad URLs will have this transition
+// type. The user may not even realize the content in these pages is a
+// separate frame, so may not care about the URL (see MANUAL below).
+PAGE_TRANSITION(AUTO_SUBFRAME, 3)
+
+// For subframe navigations that are explicitly requested by the user and
+// generate new navigation entries in the back/forward list. These are
+// probably more important than frames that were automatically loaded in
+// the background because the user probably cares about the fact that this
+// link was loaded.
+PAGE_TRANSITION(MANUAL_SUBFRAME, 4)
+
+// User got to this page by typing in the URL bar and selecting an entry
+// that did not look like a URL. For example, a match might have the URL
+// of a Google search result page, but appear like "Search Google for ...".
+// These are not quite the same as TYPED navigations because the user
+// didn't type or see the destination URL.
+// See also KEYWORD.
+PAGE_TRANSITION(GENERATED, 5)
+
+// This is a toplevel navigation. This is any content that is automatically
+// loaded in a toplevel frame. For example, opening a tab to show the ASH
+// screen saver, opening the devtools window, opening the NTP after the safe
+// browsing warning, opening web-based dialog boxes are examples of
+// AUTO_TOPLEVEL navigations.
+PAGE_TRANSITION(AUTO_TOPLEVEL, 6)
+
+// The user filled out values in a form and submitted it. NOTE that in
+// some situations submitting a form does not result in this transition
+// type. This can happen if the form uses script to submit the contents.
+PAGE_TRANSITION(FORM_SUBMIT, 7)
+
+// The user "reloaded" the page, either by hitting the reload button or by
+// hitting enter in the address bar. NOTE: This is distinct from the
+// concept of whether a particular load uses "reload semantics" (i.e.
+// bypasses cached data). For this reason, lots of code needs to pass
+// around the concept of whether a load should be treated as a "reload"
+// separately from their tracking of this transition type, which is mainly
+// used for proper scoring for consumers who care about how frequently a
+// user typed/visited a particular URL.
+//
+// SessionRestore and undo tab close use this transition type too.
+PAGE_TRANSITION(RELOAD, 8)
+
+// The url was generated from a replaceable keyword other than the default
+// search provider. If the user types a keyword (which also applies to
+// tab-to-search) in the omnibox this qualifier is applied to the transition
+// type of the generated url. TemplateURLModel then may generate an
+// additional visit with a transition type of KEYWORD_GENERATED against the
+// url 'http://' + keyword. For example, if you do a tab-to-search against
+// wikipedia the generated url has a transition qualifer of KEYWORD, and
+// TemplateURLModel generates a visit for 'wikipedia.org' with a transition
+// type of KEYWORD_GENERATED.
+PAGE_TRANSITION(KEYWORD, 9)
+
+// Corresponds to a visit generated for a keyword. See description of
+// KEYWORD for more details.
+PAGE_TRANSITION(KEYWORD_GENERATED, 10)
+
+// ADDING NEW CORE VALUE? Be sure to update the LAST_CORE and CORE_MASK
+// values below. Also update CoreTransitionString().
+PAGE_TRANSITION(LAST_CORE, PAGE_TRANSITION_KEYWORD_GENERATED)
+PAGE_TRANSITION(CORE_MASK, 0xFF)
+
+// Qualifiers
+// Any of the core values above can be augmented by one or more qualifiers.
+// These qualifiers further define the transition.
+
+// User used the Forward or Back button to navigate among browsing history.
+PAGE_TRANSITION(FORWARD_BACK, 0x01000000)
+
+// User used the address bar to trigger this navigation.
+PAGE_TRANSITION(FROM_ADDRESS_BAR, 0x02000000)
+
+// User is navigating to the home page.
+PAGE_TRANSITION(HOME_PAGE, 0x04000000)
+
+// The beginning of a navigation chain.
+PAGE_TRANSITION(CHAIN_START, 0x10000000)
+
+// The last transition in a redirect chain.
+PAGE_TRANSITION(CHAIN_END, 0x20000000)
+
+// Redirects caused by JavaScript or a meta refresh tag on the page.
+PAGE_TRANSITION(CLIENT_REDIRECT, 0x40000000)
+
+// Redirects sent from the server by HTTP headers. It might be nice to
+// break this out into 2 types in the future, permanent or temporary, if we
+// can get that information from WebKit.
+PAGE_TRANSITION(SERVER_REDIRECT, 0x80000000)
+
+// Used to test whether a transition involves a redirect.
+PAGE_TRANSITION(IS_REDIRECT_MASK, 0xC0000000)
+
+// General mask defining the bits used for the qualifiers.
+PAGE_TRANSITION(QUALIFIER_MASK, 0xFFFFFF00)