- add sources.
[platform/framework/web/crosswalk.git] / src / content / public / browser / navigation_details.h
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_DETAILS_H_
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_DETAILS_H_
7
8 #include <string>
9 #include "content/common/content_export.h"
10 #include "content/public/browser/navigation_type.h"
11 #include "url/gurl.h"
12
13 namespace content {
14
15 class NavigationEntry;
16
17 // Provides the details for a NOTIFICATION_NAV_ENTRY_COMMITTED notification.
18 // TODO(brettw) this mostly duplicates ProvisionalLoadDetails, it would be
19 // nice to unify these somehow.
20 struct CONTENT_EXPORT LoadCommittedDetails {
21   // By default, the entry will be filled according to a new main frame
22   // navigation.
23   LoadCommittedDetails();
24
25   // The committed entry. This will be the active entry in the controller.
26   NavigationEntry* entry;
27
28   // The type of navigation that just occurred. Note that not all types of
29   // navigations in the enum are valid here, since some of them don't actually
30   // cause a "commit" and won't generate this notification.
31   content::NavigationType type;
32
33   // The index of the previously committed navigation entry. This will be -1
34   // if there are no previous entries.
35   int previous_entry_index;
36
37   // The previous URL that the user was on. This may be empty if none.
38   GURL previous_url;
39
40   // True if the committed entry has replaced the exisiting one.
41   // A non-user initiated redirect causes such replacement.
42   bool did_replace_entry;
43
44   // True if the navigation was in-page. This means that the active entry's
45   // URL and the |previous_url| are the same except for reference fragments.
46   bool is_in_page;
47
48   // True when the main frame was navigated. False means the navigation was a
49   // sub-frame.
50   bool is_main_frame;
51
52   // When the committed load is a web page from the renderer, this string
53   // specifies the security state if the page is secure.
54   // See ViewHostMsg_FrameNavigate_Params.security_info, where it comes from.
55   // Use SSLManager::DeserializeSecurityInfo to decode it.
56   std::string serialized_security_info;
57
58   // Returns whether the main frame navigated to a different page (e.g., not
59   // scrolling to a fragment inside the current page). We often need this logic
60   // for showing or hiding something.
61   bool is_navigation_to_different_page() const {
62     return is_main_frame && !is_in_page;
63   }
64
65   // The HTTP status code for this entry..
66   int http_status_code;
67 };
68
69 // Provides the details for a NOTIFICATION_NAV_ENTRY_CHANGED notification.
70 struct EntryChangedDetails {
71   // The changed navigation entry after it has been updated.
72   const NavigationEntry* changed_entry;
73
74   // Indicates the current index in the back/forward list of the entry.
75   int index;
76 };
77
78 // Details sent for NOTIFY_NAV_LIST_PRUNED.
79 struct PrunedDetails {
80   // If true, count items were removed from the front of the list, otherwise
81   // count items were removed from the back of the list.
82   bool from_front;
83
84   // Number of items removed.
85   int count;
86 };
87
88 }  // namespace content
89
90 #endif  // CONTENT_PUBLIC_BROWSER_NAVIGATION_DETAILS_H_