| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 HistoryService* hs = GetHistoryService(); | 136 HistoryService* hs = GetHistoryService(); |
| 137 if (hs) | 137 if (hs) |
| 138 hs->SetPageContents(url, contents); | 138 hs->SetPageContents(url, contents); |
| 139 } | 139 } |
| 140 #endif | 140 #endif |
| 141 } | 141 } |
| 142 | 142 |
| 143 void HistoryTabHelper::OnThumbnail(const GURL& url, | 143 void HistoryTabHelper::OnThumbnail(const GURL& url, |
| 144 const ThumbnailScore& score, | 144 const ThumbnailScore& score, |
| 145 const SkBitmap& bitmap) { | 145 const SkBitmap& bitmap) { |
| 146 if (tab_contents()->profile()->IsOffTheRecord()) | 146 Profile* profile = static_cast<Profile*>(tab_contents()->context()); |
| 147 if (profile->IsOffTheRecord()) |
| 147 return; | 148 return; |
| 148 | 149 |
| 149 // Tell History about this thumbnail | 150 // Tell History about this thumbnail |
| 150 history::TopSites* ts = tab_contents()->profile()->GetTopSites(); | 151 history::TopSites* ts = profile->GetTopSites(); |
| 151 if (ts) | 152 if (ts) |
| 152 ts->SetPageThumbnail(url, bitmap, score); | 153 ts->SetPageThumbnail(url, bitmap, score); |
| 153 } | 154 } |
| 154 | 155 |
| 155 HistoryService* HistoryTabHelper::GetHistoryService() { | 156 HistoryService* HistoryTabHelper::GetHistoryService() { |
| 156 if (tab_contents()->profile()->IsOffTheRecord()) | 157 Profile* profile = static_cast<Profile*>(tab_contents()->context()); |
| 158 if (profile->IsOffTheRecord()) |
| 157 return NULL; | 159 return NULL; |
| 158 | 160 |
| 159 return tab_contents()->profile()->GetHistoryService(Profile::IMPLICIT_ACCESS); | 161 return profile->GetHistoryService(Profile::IMPLICIT_ACCESS); |
| 160 } | 162 } |
| OLD | NEW |