Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: chrome/browser/instant/instant_loader.cc

Issue 7054008: Remove history dependency from content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/instant/instant_loader.h" 5 #include "chrome/browser/instant/instant_loader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/i18n/case_conversion.h" 13 #include "base/i18n/case_conversion.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/timer.h" 15 #include "base/timer.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/favicon/favicon_service.h" 18 #include "chrome/browser/favicon/favicon_service.h"
19 #include "chrome/browser/history/history_marshaling.h" 19 #include "chrome/browser/history/history_marshaling.h"
20 #include "chrome/browser/history/history_tab_helper.h"
20 #include "chrome/browser/instant/instant_loader_delegate.h" 21 #include "chrome/browser/instant/instant_loader_delegate.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/search_engines/template_url.h" 23 #include "chrome/browser/search_engines/template_url.h"
23 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 24 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
24 #include "chrome/browser/ui/download/download_tab_helper.h" 25 #include "chrome/browser/ui/download/download_tab_helper.h"
25 #include "chrome/browser/ui/download/download_tab_helper_delegate.h" 26 #include "chrome/browser/ui/download/download_tab_helper_delegate.h"
26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
27 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/render_messages.h" 29 #include "chrome/common/render_messages.h"
29 #include "content/browser/renderer_host/render_view_host.h" 30 #include "content/browser/renderer_host/render_view_host.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 args->redirects.clear(); 307 args->redirects.clear();
307 args->redirects.push_back(url); 308 args->redirects.push_back(url);
308 309
309 // Prune all but the first entry. 310 // Prune all but the first entry.
310 add_page_vector_.erase(add_page_vector_.begin() + 1, 311 add_page_vector_.erase(add_page_vector_.begin() + 1,
311 add_page_vector_.end()); 312 add_page_vector_.end());
312 } 313 }
313 314
314 void InstantLoader::TabContentsDelegateImpl::CommitHistory( 315 void InstantLoader::TabContentsDelegateImpl::CommitHistory(
315 bool supports_instant) { 316 bool supports_instant) {
316 TabContents* tab = loader_->preview_contents()->tab_contents(); 317 TabContentsWrapper* tab = loader_->preview_contents();
317 if (tab->profile()->IsOffTheRecord()) 318 if (tab->profile()->IsOffTheRecord())
318 return; 319 return;
319 320
320 for (size_t i = 0; i < add_page_vector_.size(); ++i) 321 for (size_t i = 0; i < add_page_vector_.size(); ++i) {
321 tab->UpdateHistoryForNavigation(add_page_vector_[i].get()); 322 tab->history_tab_helper()->UpdateHistoryForNavigation(
323 add_page_vector_[i].get());
324 }
322 325
323 NavigationEntry* active_entry = tab->controller().GetActiveEntry(); 326 NavigationEntry* active_entry =
327 tab->tab_contents()->controller().GetActiveEntry();
324 if (!active_entry) { 328 if (!active_entry) {
325 // It appears to be possible to get here with no active entry. This seems 329 // It appears to be possible to get here with no active entry. This seems
326 // to be possible with an auth dialog, but I can't narrow down the 330 // to be possible with an auth dialog, but I can't narrow down the
327 // circumstances. If you hit this, file a bug with the steps you did and 331 // circumstances. If you hit this, file a bug with the steps you did and
328 // assign it to me (sky). 332 // assign it to me (sky).
329 NOTREACHED(); 333 NOTREACHED();
330 return; 334 return;
331 } 335 }
332 tab->UpdateHistoryPageTitle(*active_entry); 336 tab->history_tab_helper()->UpdateHistoryPageTitle(*active_entry);
333 337
334 FaviconService* favicon_service = 338 FaviconService* favicon_service =
335 tab->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); 339 tab->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS);
336 340
337 if (favicon_service && active_entry->favicon().is_valid() && 341 if (favicon_service && active_entry->favicon().is_valid() &&
338 !active_entry->favicon().bitmap().empty()) { 342 !active_entry->favicon().bitmap().empty()) {
339 std::vector<unsigned char> image_data; 343 std::vector<unsigned char> image_data;
340 gfx::PNGCodec::EncodeBGRASkBitmap(active_entry->favicon().bitmap(), false, 344 gfx::PNGCodec::EncodeBGRASkBitmap(active_entry->favicon().bitmap(), false,
341 &image_data); 345 &image_data);
342 favicon_service->SetFavicon(active_entry->url(), 346 favicon_service->SetFavicon(active_entry->url(),
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 Source<NavigationController>(&preview_contents_->controller())); 1031 Source<NavigationController>(&preview_contents_->controller()));
1028 #endif 1032 #endif
1029 1033
1030 registrar_.Add( 1034 registrar_.Add(
1031 this, 1035 this,
1032 NotificationType::NAV_ENTRY_COMMITTED, 1036 NotificationType::NAV_ENTRY_COMMITTED,
1033 Source<NavigationController>(&preview_contents_->controller())); 1037 Source<NavigationController>(&preview_contents_->controller()));
1034 1038
1035 preview_contents_->tab_contents()->ShowContents(); 1039 preview_contents_->tab_contents()->ShowContents();
1036 } 1040 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698