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

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

Issue 7058022: Fixes crash with instant enabled. The crash would occur if you turned (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return; 363 return;
364 364
365 if (is_active_) 365 if (is_active_)
366 return; 366 return;
367 367
368 TemplateURLModel* model = tab_contents->profile()->GetTemplateURLModel(); 368 TemplateURLModel* model = tab_contents->profile()->GetTemplateURLModel();
369 if (!model) 369 if (!model)
370 return; 370 return;
371 371
372 const TemplateURL* template_url = model->GetDefaultSearchProvider(); 372 const TemplateURL* template_url = model->GetDefaultSearchProvider();
373 if (!template_url) 373 if (!template_url || !template_url->instant_url())
374 return; 374 return;
375 375
376 if (tab_contents != tab_contents_) 376 if (tab_contents != tab_contents_)
377 DestroyPreviewContents(); 377 DestroyPreviewContents();
378 tab_contents_ = tab_contents; 378 tab_contents_ = tab_contents;
379 379
380 if (!loader_manager_.get()) 380 if (!loader_manager_.get())
381 loader_manager_.reset(new InstantLoaderManager(this)); 381 loader_manager_.reset(new InstantLoaderManager(this));
382 loader_manager_->GetInstantLoader(template_url->id()) 382 loader_manager_->GetInstantLoader(template_url->id())
383 ->MaybeLoadInstantURL(tab_contents, template_url); 383 ->MaybeLoadInstantURL(tab_contents, template_url);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 const AutocompleteMatch& match) { 726 const AutocompleteMatch& match) {
727 const TemplateURL* template_url = match.template_url; 727 const TemplateURL* template_url = match.template_url;
728 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || 728 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED ||
729 match.type == AutocompleteMatch::SEARCH_HISTORY || 729 match.type == AutocompleteMatch::SEARCH_HISTORY ||
730 match.type == AutocompleteMatch::SEARCH_SUGGEST) { 730 match.type == AutocompleteMatch::SEARCH_SUGGEST) {
731 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel(); 731 TemplateURLModel* model = tab_contents_->profile()->GetTemplateURLModel();
732 template_url = model ? model->GetDefaultSearchProvider() : NULL; 732 template_url = model ? model->GetDefaultSearchProvider() : NULL;
733 } 733 }
734 return template_url; 734 return template_url;
735 } 735 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698