summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete.cc15
-rw-r--r--chrome/browser/autocomplete/autocomplete.h9
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.cc9
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h3
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_model.cc19
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_model.h13
6 files changed, 10 insertions, 58 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index 6a87b83..b56c1bf 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -503,12 +503,6 @@ AutocompleteProvider::AutocompleteProvider(ACProviderListener* listener,
name_(name) {
}
-void AutocompleteProvider::SetProfile(Profile* profile) {
- DCHECK(profile);
- DCHECK(done_); // The controller should have already stopped us.
- profile_ = profile;
-}
-
void AutocompleteProvider::Stop() {
done_ = true;
}
@@ -835,15 +829,6 @@ AutocompleteController::~AutocompleteController() {
providers_.clear(); // Not really necessary.
}
-void AutocompleteController::SetProfile(Profile* profile) {
- Stop(true);
- for (ACProviders::iterator i(providers_.begin()); i != providers_.end(); ++i)
- (*i)->SetProfile(profile);
- input_.Clear(); // Ensure we don't try to do a "minimal_changes" query on a
- // different profile.
- profile_ = profile;
-}
-
void AutocompleteController::Start(
const string16& text,
const string16& desired_tld,
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h
index 487e8bc..11ab0b7 100644
--- a/chrome/browser/autocomplete/autocomplete.h
+++ b/chrome/browser/autocomplete/autocomplete.h
@@ -359,11 +359,6 @@ class AutocompleteProvider
Profile* profile,
const char* name);
- // Invoked when the profile changes.
- // NOTE: Do not access any previous Profile* at this point as it may have
- // already been deleted.
- void SetProfile(Profile* profile);
-
// Called to start an autocomplete query. The provider is responsible for
// tracking its matches for this query and whether it is done processing the
// query. When new matches are available or the provider finishes, it
@@ -611,10 +606,6 @@ class AutocompleteController : public ACProviderListener {
#endif
~AutocompleteController();
- // Invoked when the profile changes. This forwards the call down to all
- // the AutocompleteProviders.
- void SetProfile(Profile* profile);
-
// Starts an autocomplete query, which continues until all providers are
// done or the query is Stop()ed. It is safe to Start() a new query without
// Stop()ing the previous one.
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 3d1d19e..f015a46 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -89,13 +89,6 @@ AutocompleteEditModel::AutocompleteEditModel(
AutocompleteEditModel::~AutocompleteEditModel() {
}
-void AutocompleteEditModel::SetProfile(Profile* profile) {
- DCHECK(profile);
- profile_ = profile;
- autocomplete_controller_->SetProfile(profile);
- popup_->set_profile(profile);
-}
-
const AutocompleteEditModel::State
AutocompleteEditModel::GetStateForTabSwitch() {
// Like typing, switching tabs "accepts" the temporary text as the user
@@ -236,7 +229,7 @@ void AutocompleteEditModel::OnChanged() {
// Start Prerender of this page instead.
CHECK(tab->tab_contents());
prerender::PrerenderManager* prerender_manager =
- tab->profile()->GetPrerenderManager();
+ profile_->GetPrerenderManager();
if (prerender_manager) {
prerender_manager->AddPrerenderFromOmnibox(
CurrentMatch().destination_url);
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index 5bd9ce2..44a65bf 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -119,9 +119,6 @@ class AutocompleteEditModel : public AutocompleteControllerDelegate {
AutocompleteEditController* controller() const { return controller_; }
- // Invoked when the profile has changed.
- void SetProfile(Profile* profile);
-
Profile* profile() const { return profile_; }
// Returns the current state. This assumes we are switching tabs, and changes
diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.cc b/chrome/browser/autocomplete/autocomplete_popup_model.cc
index 459560f..041e1f0 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_model.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_model.cc
@@ -25,11 +25,9 @@
AutocompletePopupModel::AutocompletePopupModel(
AutocompletePopupView* popup_view,
- AutocompleteEditModel* edit_model,
- Profile* profile)
+ AutocompleteEditModel* edit_model)
: view_(popup_view),
edit_model_(edit_model),
- profile_(profile),
hovered_line_(kNoMatch),
selected_line_(kNoMatch) {
edit_model->set_popup_model(this);
@@ -136,7 +134,7 @@ bool AutocompletePopupModel::GetKeywordForMatch(const AutocompleteMatch& match,
if (match.template_url) {
TemplateURLService* url_service =
- TemplateURLServiceFactory::GetForProfile(profile_);
+ TemplateURLServiceFactory::GetForProfile(edit_model_->profile());
if (!url_service)
return false;
@@ -171,8 +169,9 @@ bool AutocompletePopupModel::GetKeywordForText(const string16& text,
if (keyword_hint.empty())
return false;
+ Profile* profile = edit_model_->profile();
TemplateURLService* url_service =
- TemplateURLServiceFactory::GetForProfile(profile_);
+ TemplateURLServiceFactory::GetForProfile(profile);
if (!url_service)
return false;
url_service->Load();
@@ -185,12 +184,10 @@ bool AutocompletePopupModel::GetKeywordForText(const string16& text,
// Don't provide a hint for inactive/disabled extension keywords.
if (template_url->IsExtensionKeyword()) {
- const Extension* extension = profile_->GetExtensionService()->
+ const Extension* extension = profile->GetExtensionService()->
GetExtensionById(template_url->GetExtensionId(), false);
- if (!extension ||
- (profile_->IsOffTheRecord() &&
- !profile_->GetExtensionService()->
- IsIncognitoEnabled(extension->id())))
+ if (!extension || (profile->IsOffTheRecord() &&
+ !profile->GetExtensionService()->IsIncognitoEnabled(extension->id())))
return false;
}
@@ -250,7 +247,7 @@ const SkBitmap* AutocompletePopupModel::GetIconIfExtensionMatch(
if (!match.template_url || !match.template_url->IsExtensionKeyword())
return NULL;
- return &profile_->GetExtensionService()->GetOmniboxPopupIcon(
+ return &edit_model_->profile()->GetExtensionService()->GetOmniboxPopupIcon(
match.template_url->GetExtensionId());
}
diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.h b/chrome/browser/autocomplete/autocomplete_popup_model.h
index fc971aa..173800a 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_model.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_model.h
@@ -11,22 +11,14 @@
#include "chrome/browser/autocomplete/autocomplete_edit.h"
class AutocompletePopupView;
-class Profile;
class SkBitmap;
class AutocompletePopupModel {
public:
AutocompletePopupModel(AutocompletePopupView* popup_view,
- AutocompleteEditModel* edit_model,
- Profile* profile);
+ AutocompleteEditModel* edit_model);
~AutocompletePopupModel();
- // Invoked when the profile has changed.
- void set_profile(Profile* profile) { profile_ = profile; }
-
- // TODO(sky): see about removing this.
- Profile* profile() const { return profile_; }
-
// Returns true if the popup is currently open.
bool IsOpen() const;
@@ -115,9 +107,6 @@ class AutocompletePopupModel {
AutocompleteEditModel* edit_model_;
- // Profile for current tab.
- Profile* profile_;
-
// The line that's currently hovered. If we're not drawing a hover rect,
// this will be kNoMatch, even if the cursor is over the popup contents.
size_t hovered_line_;