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

Unified Diff: chrome/browser/ui/gtk/location_bar_view_gtk.cc

Issue 7574021: Remove frontend code that allows for dynamic profile setting, and read the profile off the browse... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/location_bar_view_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/location_bar_view_gtk.cc (revision 95527)
+++ chrome/browser/ui/gtk/location_bar_view_gtk.cc (working copy)
@@ -161,7 +161,6 @@
tab_to_search_hint_leading_label_(NULL),
tab_to_search_hint_icon_(NULL),
tab_to_search_hint_trailing_label_(NULL),
- profile_(NULL),
command_updater_(browser->command_updater()),
toolbar_model_(browser->toolbar_model()),
browser_(browser),
@@ -187,7 +186,8 @@
void LocationBarViewGtk::Init(bool popup_window_mode) {
popup_window_mode_ = popup_window_mode;
- theme_service_ = GtkThemeService::GetFrom(profile_);
+ Profile* profile = browser_->profile();
+ theme_service_ = GtkThemeService::GetFrom(profile);
// Create the widget first, so we can pass it to the OmniboxViewGtk.
hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding));
@@ -199,12 +199,8 @@
gtk_widget_set_redraw_on_allocate(hbox_.get(), TRUE);
// Now initialize the OmniboxViewGtk.
- location_entry_.reset(new OmniboxViewGtk(this,
- toolbar_model_,
- profile_,
- command_updater_,
- popup_window_mode_,
- hbox_.get()));
+ location_entry_.reset(new OmniboxViewGtk(this, toolbar_model_, profile,
+ command_updater_, popup_window_mode_, hbox_.get()));
location_entry_->Init();
g_signal_connect(hbox_.get(), "expose-event",
@@ -313,7 +309,7 @@
for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
ContentSettingImageViewGtk* content_setting_view =
new ContentSettingImageViewGtk(
- static_cast<ContentSettingsType>(i), this, profile_);
+ static_cast<ContentSettingsType>(i), this);
content_setting_views_.push_back(content_setting_view);
gtk_box_pack_end(GTK_BOX(content_setting_hbox_.get()),
content_setting_view->widget(), FALSE, FALSE, 0);
@@ -335,7 +331,7 @@
chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
Source<ThemeService>(theme_service_));
edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled,
- profile_->GetPrefs(), this);
+ profile->GetPrefs(), this);
theme_service_->InitThemesFor(this);
}
@@ -414,10 +410,6 @@
ui::CHROME_NAMED_URL);
}
-void LocationBarViewGtk::SetProfile(Profile* profile) {
- profile_ = profile;
-}
-
TabContents* LocationBarViewGtk::GetTabContents() const {
return browser_->GetSelectedTabContents();
}
@@ -554,14 +546,12 @@
}
void LocationBarViewGtk::OnSetFocus() {
- AccessibilityTextBoxInfo info(
- profile_,
- l10n_util::GetStringUTF8(IDS_ACCNAME_LOCATION).c_str(),
- false);
+ Profile* profile = browser_->profile();
+ AccessibilityTextBoxInfo info(profile,
+ l10n_util::GetStringUTF8(IDS_ACCNAME_LOCATION), false);
NotificationService::current()->Notify(
chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED,
- Source<Profile>(profile_),
- Details<AccessibilityTextBoxInfo>(&info));
+ Source<Profile>(profile), Details<AccessibilityTextBoxInfo>(&info));
// Update the keyword and search hint states.
OnChanged();
@@ -641,7 +631,7 @@
void LocationBarViewGtk::UpdatePageActions() {
std::vector<ExtensionAction*> page_actions;
- ExtensionService* service = profile_->GetExtensionService();
+ ExtensionService* service = browser_->profile()->GetExtensionService();
if (!service)
return;
@@ -658,7 +648,7 @@
for (size_t i = 0; i < page_actions.size(); ++i) {
page_action_views_.push_back(
- new PageActionViewGtk(this, profile_, page_actions[i]));
+ new PageActionViewGtk(this, page_actions[i]));
gtk_box_pack_end(GTK_BOX(page_action_hbox_.get()),
page_action_views_[i]->widget(), FALSE, FALSE, 0);
}
@@ -824,8 +814,7 @@
GdkEventExpose* event) {
// If we're not using GTK theming, draw our own border over the edge pixels
// of the background.
- if (!profile_ ||
- !GtkThemeService::GetFrom(profile_)->UsingNativeTheme()) {
+ if (!GtkThemeService::GetFrom(browser_->profile())->UsingNativeTheme()) {
int left, center, right;
if (popup_window_mode_) {
left = right = IDR_LOCATIONBG_POPUPMODE_EDGE;
@@ -935,9 +924,9 @@
if (keyword.empty())
return;
- DCHECK(profile_);
+ Profile* profile = browser_->profile();
TemplateURLService* template_url_service =
- TemplateURLServiceFactory::GetForProfile(profile_);
+ TemplateURLServiceFactory::GetForProfile(profile);
if (!template_url_service)
return;
@@ -963,7 +952,7 @@
if (is_extension_keyword) {
const TemplateURL* template_url =
template_url_service->GetTemplateURLForKeyword(keyword);
- const SkBitmap& bitmap = profile_->GetExtensionService()->
+ const SkBitmap& bitmap = profile->GetExtensionService()->
GetOmniboxIcon(template_url->GetExtensionId());
GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap);
gtk_image_set_from_pixbuf(GTK_IMAGE(tab_to_search_magnifier_), pixbuf);
@@ -980,9 +969,8 @@
if (keyword.empty())
return;
- DCHECK(profile_);
TemplateURLService* template_url_service =
- TemplateURLServiceFactory::GetForProfile(profile_);
+ TemplateURLServiceFactory::GetForProfile(browser_->profile());
if (!template_url_service)
return;
@@ -1021,7 +1009,8 @@
gfx::Rect bounds = gtk_util::WidgetBounds(location_icon_image_);
bounds.set_x(bounds.x() + kFirstRunBubbleLeftSpacing);
- FirstRunBubble::Show(profile_, location_icon_image_, bounds, bubble_type);
+ FirstRunBubble::Show(browser_->profile(), location_icon_image_, bounds,
+ bubble_type);
}
gboolean LocationBarViewGtk::OnIconReleased(GtkWidget* sender,
@@ -1056,7 +1045,7 @@
}
GURL url;
- if (!gtk_util::URLFromPrimarySelection(profile_, &url))
+ if (!gtk_util::URLFromPrimarySelection(browser_->profile(), &url))
return FALSE;
tab->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED);
@@ -1125,7 +1114,8 @@
if (!star_.get())
return;
- BookmarkBubbleGtk::Show(star_.get(), profile_, url, newly_bookmarked);
+ BookmarkBubbleGtk::Show(star_.get(), browser_->profile(), url,
+ newly_bookmarked);
}
void LocationBarViewGtk::SetStarred(bool starred) {
@@ -1222,8 +1212,7 @@
// LocationBarViewGtk::ContentSettingImageViewGtk
LocationBarViewGtk::ContentSettingImageViewGtk::ContentSettingImageViewGtk(
ContentSettingsType content_type,
- const LocationBarViewGtk* parent,
- Profile* profile)
+ const LocationBarViewGtk* parent)
: content_setting_image_model_(
ContentSettingImageModel::CreateContentSettingImageModel(
content_type)),
@@ -1233,7 +1222,6 @@
image_(gtk_image_new()),
label_(gtk_label_new(NULL)),
parent_(parent),
- profile_(profile),
content_setting_bubble_(NULL),
animation_(this),
method_factory_(this) {
@@ -1284,7 +1272,7 @@
}
gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()),
- GtkThemeService::GetFrom(profile_)->GetPixbufNamed(
+ GtkThemeService::GetFrom(parent_->browser()->profile())->GetPixbufNamed(
content_setting_image_model_->get_icon()));
gtk_widget_set_tooltip_text(widget(),
@@ -1368,12 +1356,13 @@
TabContentsWrapper* tab_contents = parent_->GetTabContentsWrapper();
if (!tab_contents)
return TRUE;
+ Profile* profile = parent_->browser()->profile();
content_setting_bubble_ = new ContentSettingBubbleGtk(
sender, this,
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- parent_->browser(), tab_contents, profile_,
+ parent_->browser(), tab_contents, profile,
content_setting_image_model_->get_content_settings_type()),
- profile_, tab_contents->tab_contents());
+ profile, tab_contents->tab_contents());
return TRUE;
}
@@ -1416,10 +1405,9 @@
// LocationBarViewGtk::PageActionViewGtk
LocationBarViewGtk::PageActionViewGtk::PageActionViewGtk(
- LocationBarViewGtk* owner, Profile* profile,
+ LocationBarViewGtk* owner,
ExtensionAction* page_action)
: owner_(NULL),
- profile_(profile),
page_action_(page_action),
last_icon_pixbuf_(NULL),
tracker_(this),
@@ -1439,8 +1427,9 @@
image_.Own(gtk_image_new());
gtk_container_add(GTK_CONTAINER(event_box_.get()), image_.get());
- const Extension* extension = profile->GetExtensionService()->
- GetExtensionById(page_action->extension_id(), false);
+ const Extension* extension = owner->browser()->profile()->
+ GetExtensionService()->GetExtensionById(page_action->extension_id(),
+ false);
DCHECK(extension);
// Load all the icons declared in the manifest. This is the contents of the
@@ -1596,19 +1585,16 @@
gboolean LocationBarViewGtk::PageActionViewGtk::OnButtonPressed(
GtkWidget* sender,
GdkEventButton* event) {
+ Profile* profile = owner_->browser()->profile();
if (event->button != 3) {
if (!ShowPopup(false)) {
- ExtensionService* service = profile_->GetExtensionService();
- service->browser_event_router()->PageActionExecuted(
- profile_,
- page_action_->extension_id(),
- page_action_->id(),
- current_tab_id_,
- current_url_.spec(),
- event->button);
+ ExtensionService* service = profile->GetExtensionService();
+ service->browser_event_router()->PageActionExecuted(profile,
+ page_action_->extension_id(), page_action_->id(), current_tab_id_,
+ current_url_.spec(), event->button);
}
} else {
- const Extension* extension = profile_->GetExtensionService()->
+ const Extension* extension = profile->GetExtensionService()->
GetExtensionById(page_action()->extension_id(), false);
if (extension->ShowConfigureContextMenus()) {
@@ -1624,7 +1610,8 @@
}
gboolean LocationBarViewGtk::PageActionViewGtk::OnExposeEvent(
- GtkWidget* widget, GdkEventExpose* event) {
+ GtkWidget* widget,
+ GdkEventExpose* event) {
TabContents* contents = owner_->GetTabContents();
if (!contents)
return FALSE;
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.h ('k') | chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698