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