| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| ===================================================================
|
| --- chrome/browser/ui/views/location_bar/location_bar_view.cc (revision 95527)
|
| +++ chrome/browser/ui/views/location_bar/location_bar_view.cc (working copy)
|
| @@ -102,13 +102,11 @@
|
|
|
| // LocationBarView -----------------------------------------------------------
|
|
|
| -LocationBarView::LocationBarView(Profile* profile,
|
| - Browser* browser,
|
| +LocationBarView::LocationBarView(Browser* browser,
|
| ToolbarModel* model,
|
| Delegate* delegate,
|
| Mode mode)
|
| - : profile_(profile),
|
| - browser_(browser),
|
| + : browser_(browser),
|
| model_(model),
|
| delegate_(delegate),
|
| disposition_(CURRENT_TAB),
|
| @@ -127,7 +125,6 @@
|
| bubble_type_(FirstRun::MINIMAL_BUBBLE),
|
| template_url_service_(NULL),
|
| animation_offset_(0) {
|
| - DCHECK(profile_);
|
| set_id(VIEW_ID_LOCATION_BAR);
|
| set_focusable(true);
|
|
|
| @@ -135,7 +132,7 @@
|
| painter_.reset(new views::HorizontalPainter(kNormalModeBackgroundImages));
|
|
|
| edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled,
|
| - profile_->GetPrefs(), this);
|
| + browser_->profile()->GetPrefs(), this);
|
| }
|
|
|
| LocationBarView::~LocationBarView() {
|
| @@ -173,20 +170,20 @@
|
|
|
| // URL edit field.
|
| // View container for URL edit field.
|
| + Profile* profile = browser_->profile();
|
| #if defined(OS_WIN)
|
| if (views::Widget::IsPureViews()) {
|
| - OmniboxViewViews* omnibox_view =
|
| - new OmniboxViewViews(this, model_, profile_,
|
| - browser_->command_updater(), mode_ == POPUP, this);
|
| + OmniboxViewViews* omnibox_view = new OmniboxViewViews(this, model_, profile,
|
| + browser_->command_updater(), mode_ == POPUP, this);
|
| omnibox_view->Init();
|
| location_entry_.reset(omnibox_view);
|
| } else {
|
| location_entry_.reset(new OmniboxViewWin(font_, this, model_, this,
|
| - GetWidget()->GetNativeView(), profile_, browser_->command_updater(),
|
| + GetWidget()->GetNativeView(), browser_->command_updater(),
|
| mode_ == POPUP, this));
|
| }
|
| #else
|
| - location_entry_.reset(OmniboxViewGtk::Create(this, model_, profile_,
|
| + location_entry_.reset(OmniboxViewGtk::Create(this, model_, profile,
|
| browser_->command_updater(), mode_ == POPUP, this));
|
| #endif
|
|
|
| @@ -195,22 +192,22 @@
|
|
|
| selected_keyword_view_ = new SelectedKeywordView(
|
| kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER,
|
| - GetColor(ToolbarModel::NONE, TEXT), profile_),
|
| + GetColor(ToolbarModel::NONE, TEXT), profile);
|
| AddChildView(selected_keyword_view_);
|
| selected_keyword_view_->SetFont(font_);
|
| selected_keyword_view_->SetVisible(false);
|
|
|
| SkColor dimmed_text = GetColor(ToolbarModel::NONE, DEEMPHASIZED_TEXT);
|
|
|
| - keyword_hint_view_ = new KeywordHintView(profile_);
|
| + keyword_hint_view_ = new KeywordHintView(profile);
|
| AddChildView(keyword_hint_view_);
|
| keyword_hint_view_->SetVisible(false);
|
| keyword_hint_view_->SetFont(font_);
|
| keyword_hint_view_->SetColor(dimmed_text);
|
|
|
| for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
|
| - ContentSettingImageView* content_blocked_view = new ContentSettingImageView(
|
| - static_cast<ContentSettingsType>(i), this, profile_);
|
| + ContentSettingImageView* content_blocked_view =
|
| + new ContentSettingImageView(static_cast<ContentSettingsType>(i), this);
|
| content_setting_views_.push_back(content_blocked_view);
|
| AddChildView(content_blocked_view);
|
| content_blocked_view->SetVisible(false);
|
| @@ -347,19 +344,6 @@
|
| this, ui::AccessibilityTypes::EVENT_FOCUS, true);
|
| }
|
|
|
| -void LocationBarView::SetProfile(Profile* profile) {
|
| - DCHECK(profile);
|
| - if (profile_ != profile) {
|
| - profile_ = profile;
|
| - location_entry_->model()->SetProfile(profile);
|
| - selected_keyword_view_->set_profile(profile);
|
| - keyword_hint_view_->set_profile(profile);
|
| - for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
|
| - i != content_setting_views_.end(); ++i)
|
| - (*i)->set_profile(profile);
|
| - }
|
| -}
|
| -
|
| void LocationBarView::SetPreviewEnabledPageAction(ExtensionAction* page_action,
|
| bool preview_enabled) {
|
| if (mode_ != NORMAL)
|
| @@ -406,7 +390,7 @@
|
| views::View::ConvertPointToScreen(star_view_, &origin);
|
| screen_bounds.set_origin(origin);
|
| browser::ShowBookmarkBubbleView(GetWidget(), screen_bounds, star_view_,
|
| - profile_, url, newly_bookmarked);
|
| + browser_->profile(), url, newly_bookmarked);
|
| }
|
|
|
| gfx::Point LocationBarView::GetLocationEntryOrigin() const {
|
| @@ -572,12 +556,13 @@
|
| if (show_selected_keyword) {
|
| if (selected_keyword_view_->keyword() != keyword) {
|
| selected_keyword_view_->SetKeyword(keyword);
|
| + Profile* profile = browser_->profile();
|
| const TemplateURL* template_url =
|
| - TemplateURLServiceFactory::GetForProfile(profile_)->
|
| + TemplateURLServiceFactory::GetForProfile(profile)->
|
| GetTemplateURLForKeyword(keyword);
|
| if (template_url && template_url->IsExtensionKeyword()) {
|
| - const SkBitmap& bitmap = profile_->GetExtensionService()->
|
| - GetOmniboxIcon(template_url->GetExtensionId());
|
| + const SkBitmap& bitmap = profile->GetExtensionService()->GetOmniboxIcon(
|
| + template_url->GetExtensionId());
|
| selected_keyword_view_->SetImage(bitmap);
|
| selected_keyword_view_->set_is_extension_icon(true);
|
| } else {
|
| @@ -937,7 +922,7 @@
|
| if (mode_ != NORMAL)
|
| return;
|
|
|
| - ExtensionService* service = profile_->GetExtensionService();
|
| + ExtensionService* service = browser_->profile()->GetExtensionService();
|
| if (!service)
|
| return;
|
|
|
| @@ -965,7 +950,7 @@
|
| // inserted in left-to-right order for accessibility.
|
| for (int i = page_actions.size() - 1; i >= 0; --i) {
|
| page_action_views_[i] = new PageActionWithBadgeView(
|
| - new PageActionImageView(this, profile_, page_actions[i]));
|
| + new PageActionImageView(this, page_actions[i]));
|
| page_action_views_[i]->SetVisible(false);
|
| AddChildViewAt(page_action_views_[i], GetIndexOf(star_view_));
|
| }
|
| @@ -1021,8 +1006,8 @@
|
| if (base::i18n::IsRTL())
|
| origin.set_x(width() - origin.x());
|
| views::View::ConvertPointToScreen(this, &origin);
|
| - FirstRunBubble::Show(profile_, GetWidget(), gfx::Rect(origin, gfx::Size()),
|
| - BubbleBorder::TOP_LEFT, bubble_type);
|
| + FirstRunBubble::Show(browser_->profile(), GetWidget(),
|
| + gfx::Rect(origin, gfx::Size()), BubbleBorder::TOP_LEFT, bubble_type);
|
| #endif
|
| }
|
|
|
| @@ -1115,7 +1100,7 @@
|
| void LocationBarView::ShowFirstRunBubble(FirstRun::BubbleType bubble_type) {
|
| // Wait until search engines have loaded to show the first run bubble.
|
| TemplateURLService* url_service =
|
| - TemplateURLServiceFactory::GetForProfile(profile_);
|
| + TemplateURLServiceFactory::GetForProfile(browser_->profile());
|
| if (!url_service->loaded()) {
|
| bubble_type_ = bubble_type;
|
| template_url_service_ = url_service;
|
|
|