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 "chrome/browser/history/history_tab_helper.h" | 5 #include "chrome/browser/history/history_tab_helper.h" |
6 | 6 |
7 #include "chrome/browser/history/history.h" | 7 #include "chrome/browser/history/history.h" |
8 #include "chrome/browser/history/top_sites.h" | 8 #include "chrome/browser/history/top_sites.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 scoped_refptr<history::HistoryAddPageArgs> | 45 scoped_refptr<history::HistoryAddPageArgs> |
46 HistoryTabHelper::CreateHistoryAddPageArgs( | 46 HistoryTabHelper::CreateHistoryAddPageArgs( |
47 const GURL& virtual_url, | 47 const GURL& virtual_url, |
48 const content::LoadCommittedDetails& details, | 48 const content::LoadCommittedDetails& details, |
49 const content::FrameNavigateParams& params) { | 49 const content::FrameNavigateParams& params) { |
50 scoped_refptr<history::HistoryAddPageArgs> add_page_args( | 50 scoped_refptr<history::HistoryAddPageArgs> add_page_args( |
51 new history::HistoryAddPageArgs( | 51 new history::HistoryAddPageArgs( |
52 params.url, base::Time::Now(), tab_contents(), params.page_id, | 52 params.url, base::Time::Now(), tab_contents(), params.page_id, |
53 params.referrer, params.redirects, params.transition, | 53 params.referrer.url, params.redirects, params.transition, |
54 history::SOURCE_BROWSED, details.did_replace_entry)); | 54 history::SOURCE_BROWSED, details.did_replace_entry)); |
55 if (content::PageTransitionIsMainFrame(params.transition) && | 55 if (content::PageTransitionIsMainFrame(params.transition) && |
56 virtual_url != params.url) { | 56 virtual_url != params.url) { |
57 // Hack on the "virtual" URL so that it will appear in history. For some | 57 // Hack on the "virtual" URL so that it will appear in history. For some |
58 // types of URLs, we will display a magic URL that is different from where | 58 // types of URLs, we will display a magic URL that is different from where |
59 // the page is actually navigated. We want the user to see in history what | 59 // the page is actually navigated. We want the user to see in history what |
60 // they saw in the URL bar, so we add the virtual URL as a redirect. This | 60 // they saw in the URL bar, so we add the virtual URL as a redirect. This |
61 // only applies to the main frame, as the virtual URL doesn't apply to | 61 // only applies to the main frame, as the virtual URL doesn't apply to |
62 // sub-frames. | 62 // sub-frames. |
63 add_page_args->url = virtual_url; | 63 add_page_args->url = virtual_url; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 | 162 |
163 HistoryService* HistoryTabHelper::GetHistoryService() { | 163 HistoryService* HistoryTabHelper::GetHistoryService() { |
164 Profile* profile = | 164 Profile* profile = |
165 Profile::FromBrowserContext(tab_contents()->browser_context()); | 165 Profile::FromBrowserContext(tab_contents()->browser_context()); |
166 if (profile->IsOffTheRecord()) | 166 if (profile->IsOffTheRecord()) |
167 return NULL; | 167 return NULL; |
168 | 168 |
169 return profile->GetHistoryService(Profile::IMPLICIT_ACCESS); | 169 return profile->GetHistoryService(Profile::IMPLICIT_ACCESS); |
170 } | 170 } |
OLD | NEW |