OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/public/browser/global_request_id.h" | 19 #include "content/public/browser/global_request_id.h" |
| 20 #include "content/public/browser/restore_type.h" |
20 #include "content/public/browser/session_storage_namespace.h" | 21 #include "content/public/browser/session_storage_namespace.h" |
21 #include "content/public/browser/site_instance.h" | 22 #include "content/public/browser/site_instance.h" |
22 #include "content/public/common/referrer.h" | 23 #include "content/public/common/referrer.h" |
23 #include "content/public/common/resource_request_body.h" | 24 #include "content/public/common/resource_request_body.h" |
24 #include "ui/base/page_transition_types.h" | 25 #include "ui/base/page_transition_types.h" |
25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
26 | 27 |
27 namespace base { | 28 namespace base { |
28 | 29 |
29 class RefCountedString; | 30 class RefCountedString; |
30 | 31 |
31 } // namespace base | 32 } // namespace base |
32 | 33 |
33 namespace content { | 34 namespace content { |
34 | 35 |
35 class BrowserContext; | 36 class BrowserContext; |
36 class NavigationEntry; | 37 class NavigationEntry; |
37 class WebContents; | 38 class WebContents; |
38 | 39 |
39 // A NavigationController maintains the back-forward list for a WebContents and | 40 // A NavigationController maintains the back-forward list for a WebContents and |
40 // manages all navigation within that list. | 41 // manages all navigation within that list. |
41 // | 42 // |
42 // Each NavigationController belongs to one WebContents; each WebContents has | 43 // Each NavigationController belongs to one WebContents; each WebContents has |
43 // exactly one NavigationController. | 44 // exactly one NavigationController. |
44 class NavigationController { | 45 class NavigationController { |
45 public: | 46 public: |
46 // Note: NO_RELOAD is used in general, but behaviors depend on context. | |
47 // If it is used for tab restore, or history navigation, it loads preferring | |
48 // cache (which may be stale). | |
49 enum ReloadType { | |
50 NO_RELOAD, // Normal load, restore, or history navigation. | |
51 RELOAD, // Normal (cache-validating) reload. | |
52 RELOAD_MAIN_RESOURCE, // Reload validating only the main resource. | |
53 RELOAD_BYPASSING_CACHE, // Reload bypassing the cache (shift-reload). | |
54 RELOAD_ORIGINAL_REQUEST_URL, // Reload using the original request URL. | |
55 RELOAD_DISABLE_LOFI_MODE // Reload with Lo-Fi mode disabled. | |
56 }; | |
57 | |
58 // Load type used in LoadURLParams. | 47 // Load type used in LoadURLParams. |
59 // | 48 // |
60 // A Java counterpart will be generated for this enum. | 49 // A Java counterpart will be generated for this enum. |
61 // GENERATED_JAVA_ENUM_PACKAGE: ( | 50 // GENERATED_JAVA_ENUM_PACKAGE: ( |
62 // org.chromium.content_public.browser.navigation_controller) | 51 // org.chromium.content_public.browser.navigation_controller) |
63 // GENERATED_JAVA_PREFIX_TO_STRIP: LOAD_TYPE_ | 52 // GENERATED_JAVA_PREFIX_TO_STRIP: LOAD_TYPE_ |
64 enum LoadURLType { | 53 enum LoadURLType { |
65 // For loads that do not fall into any types below. | 54 // For loads that do not fall into any types below. |
66 LOAD_TYPE_DEFAULT, | 55 LOAD_TYPE_DEFAULT, |
67 | 56 |
(...skipping 23 matching lines...) Expand all Loading... |
91 // Use the default user agent. | 80 // Use the default user agent. |
92 UA_OVERRIDE_FALSE, | 81 UA_OVERRIDE_FALSE, |
93 | 82 |
94 // Use the user agent override, if it's available. | 83 // Use the user agent override, if it's available. |
95 UA_OVERRIDE_TRUE | 84 UA_OVERRIDE_TRUE |
96 | 85 |
97 // Adding new UserAgentOverrideOption? Also update LoadUrlParams.java | 86 // Adding new UserAgentOverrideOption? Also update LoadUrlParams.java |
98 // static constants. | 87 // static constants. |
99 }; | 88 }; |
100 | 89 |
101 enum RestoreType { | |
102 // Indicates the restore is from the current session. For example, restoring | |
103 // a closed tab. | |
104 RESTORE_CURRENT_SESSION, | |
105 | |
106 // Restore from the previous session. | |
107 RESTORE_LAST_SESSION_EXITED_CLEANLY, | |
108 RESTORE_LAST_SESSION_CRASHED, | |
109 }; | |
110 | |
111 // Creates a navigation entry and translates the virtual url to a real one. | 90 // Creates a navigation entry and translates the virtual url to a real one. |
112 // This is a general call; prefer LoadURL[FromRenderer]/TransferURL below. | 91 // This is a general call; prefer LoadURL[FromRenderer]/TransferURL below. |
113 // Extra headers are separated by \n. | 92 // Extra headers are separated by \n. |
114 CONTENT_EXPORT static std::unique_ptr<NavigationEntry> CreateNavigationEntry( | 93 CONTENT_EXPORT static std::unique_ptr<NavigationEntry> CreateNavigationEntry( |
115 const GURL& url, | 94 const GURL& url, |
116 const Referrer& referrer, | 95 const Referrer& referrer, |
117 ui::PageTransition transition, | 96 ui::PageTransition transition, |
118 bool is_renderer_initiated, | 97 bool is_renderer_initiated, |
119 const std::string& extra_headers, | 98 const std::string& extra_headers, |
120 BrowserContext* browser_context); | 99 BrowserContext* browser_context); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 473 |
495 private: | 474 private: |
496 // This interface should only be implemented inside content. | 475 // This interface should only be implemented inside content. |
497 friend class NavigationControllerImpl; | 476 friend class NavigationControllerImpl; |
498 NavigationController() {} | 477 NavigationController() {} |
499 }; | 478 }; |
500 | 479 |
501 } // namespace content | 480 } // namespace content |
502 | 481 |
503 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ | 482 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_CONTROLLER_H_ |
OLD | NEW |