OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/browser/tab_contents/navigation_entry.h" | 5 #include "content/browser/tab_contents/navigation_entry.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "content/browser/content_frame.h" |
9 #include "content/browser/site_instance.h" | 10 #include "content/browser/site_instance.h" |
10 #include "content/public/browser/content_browser_client.h" | 11 #include "content/public/browser/content_browser_client.h" |
11 #include "content/public/common/content_constants.h" | 12 #include "content/public/common/content_constants.h" |
12 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
13 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
14 #include "ui/base/text/text_elider.h" | 15 #include "ui/base/text/text_elider.h" |
15 | 16 |
16 // Use this to get a new unique ID for a NavigationEntry during construction. | 17 // Use this to get a new unique ID for a NavigationEntry during construction. |
17 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). | 18 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
18 static int GetUniqueID() { | 19 static int GetUniqueID() { |
(...skipping 17 matching lines...) Expand all Loading... |
36 | 37 |
37 NavigationEntry::NavigationEntry() | 38 NavigationEntry::NavigationEntry() |
38 : unique_id_(GetUniqueID()), | 39 : unique_id_(GetUniqueID()), |
39 site_instance_(NULL), | 40 site_instance_(NULL), |
40 page_type_(content::PAGE_TYPE_NORMAL), | 41 page_type_(content::PAGE_TYPE_NORMAL), |
41 update_virtual_url_with_url_(false), | 42 update_virtual_url_with_url_(false), |
42 page_id_(-1), | 43 page_id_(-1), |
43 transition_type_(content::PAGE_TRANSITION_LINK), | 44 transition_type_(content::PAGE_TRANSITION_LINK), |
44 has_post_data_(false), | 45 has_post_data_(false), |
45 restore_type_(RESTORE_NONE), | 46 restore_type_(RESTORE_NONE), |
46 is_renderer_initiated_(false) { | 47 is_renderer_initiated_(false), |
| 48 opener_content_frame_id_(content::INVALID_CONTENT_FRAME_ID) { |
47 } | 49 } |
48 | 50 |
49 NavigationEntry::NavigationEntry(SiteInstance* instance, | 51 NavigationEntry::NavigationEntry(SiteInstance* instance, |
50 int page_id, | 52 int page_id, |
51 const GURL& url, | 53 const GURL& url, |
52 const content::Referrer& referrer, | 54 const content::Referrer& referrer, |
53 const string16& title, | 55 const string16& title, |
54 content::PageTransition transition_type, | 56 content::PageTransition transition_type, |
55 bool is_renderer_initiated) | 57 bool is_renderer_initiated) |
56 : unique_id_(GetUniqueID()), | 58 : unique_id_(GetUniqueID()), |
57 site_instance_(instance), | 59 site_instance_(instance), |
58 page_type_(content::PAGE_TYPE_NORMAL), | 60 page_type_(content::PAGE_TYPE_NORMAL), |
59 url_(url), | 61 url_(url), |
60 referrer_(referrer), | 62 referrer_(referrer), |
61 update_virtual_url_with_url_(false), | 63 update_virtual_url_with_url_(false), |
62 title_(title), | 64 title_(title), |
63 page_id_(page_id), | 65 page_id_(page_id), |
64 transition_type_(transition_type), | 66 transition_type_(transition_type), |
65 has_post_data_(false), | 67 has_post_data_(false), |
66 restore_type_(RESTORE_NONE), | 68 restore_type_(RESTORE_NONE), |
67 is_renderer_initiated_(is_renderer_initiated) { | 69 is_renderer_initiated_(is_renderer_initiated), |
| 70 opener_content_frame_id_(content::INVALID_CONTENT_FRAME_ID) { |
68 } | 71 } |
69 | 72 |
70 NavigationEntry::~NavigationEntry() { | 73 NavigationEntry::~NavigationEntry() { |
71 } | 74 } |
72 | 75 |
73 void NavigationEntry::set_site_instance(SiteInstance* site_instance) { | 76 void NavigationEntry::set_site_instance(SiteInstance* site_instance) { |
74 site_instance_ = site_instance; | 77 site_instance_ = site_instance; |
75 } | 78 } |
76 | 79 |
77 const string16& NavigationEntry::GetTitleForDisplay( | 80 const string16& NavigationEntry::GetTitleForDisplay( |
(...skipping 23 matching lines...) Expand all Loading... |
101 title = title.substr(slashpos + 1); | 104 title = title.substr(slashpos + 1); |
102 } | 105 } |
103 | 106 |
104 ui::ElideString(title, content::kMaxTitleChars, &cached_display_title_); | 107 ui::ElideString(title, content::kMaxTitleChars, &cached_display_title_); |
105 return cached_display_title_; | 108 return cached_display_title_; |
106 } | 109 } |
107 | 110 |
108 bool NavigationEntry::IsViewSourceMode() const { | 111 bool NavigationEntry::IsViewSourceMode() const { |
109 return virtual_url_.SchemeIs(chrome::kViewSourceScheme); | 112 return virtual_url_.SchemeIs(chrome::kViewSourceScheme); |
110 } | 113 } |
OLD | NEW |