| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/browser_toolbar_gtk.h" | 5 #include "chrome/browser/gtk/browser_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/base_paths_linux.h" | 10 #include "base/base_paths_linux.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
| 13 #include "chrome/browser/browser.h" | 13 #include "chrome/browser/browser.h" |
| 14 #include "chrome/browser/gtk/back_forward_menu_model_gtk.h" | 14 #include "chrome/browser/gtk/back_forward_menu_model_gtk.h" |
| 15 #include "chrome/browser/gtk/custom_button.h" | 15 #include "chrome/browser/gtk/custom_button.h" |
| 16 #include "chrome/browser/gtk/go_button_gtk.h" |
| 16 #include "chrome/browser/gtk/location_bar_view_gtk.h" | 17 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
| 17 #include "chrome/browser/gtk/nine_box.h" | 18 #include "chrome/browser/gtk/nine_box.h" |
| 18 #include "chrome/browser/gtk/standard_menus.h" | 19 #include "chrome/browser/gtk/standard_menus.h" |
| 19 #include "chrome/browser/gtk/toolbar_star_toggle_gtk.h" | 20 #include "chrome/browser/gtk/toolbar_star_toggle_gtk.h" |
| 20 #include "chrome/browser/net/url_fixer_upper.h" | 21 #include "chrome/browser/net/url_fixer_upper.h" |
| 21 #include "chrome/browser/profile.h" | 22 #include "chrome/browser/profile.h" |
| 22 #include "chrome/common/l10n_util.h" | 23 #include "chrome/common/l10n_util.h" |
| 23 #include "chrome/common/notification_details.h" | 24 #include "chrome/common/notification_details.h" |
| 24 #include "chrome/common/notification_type.h" | 25 #include "chrome/common/notification_type.h" |
| 25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (*show_home_button_) | 115 if (*show_home_button_) |
| 115 home_.reset(MakeHomeButton()); | 116 home_.reset(MakeHomeButton()); |
| 116 | 117 |
| 117 gtk_box_pack_start(GTK_BOX(toolbar_), gtk_label_new(" "), FALSE, FALSE, 0); | 118 gtk_box_pack_start(GTK_BOX(toolbar_), gtk_label_new(" "), FALSE, FALSE, 0); |
| 118 | 119 |
| 119 star_.reset(BuildStarButton(l10n_util::GetString(IDS_TOOLTIP_STAR))); | 120 star_.reset(BuildStarButton(l10n_util::GetString(IDS_TOOLTIP_STAR))); |
| 120 | 121 |
| 121 location_bar_->Init(); | 122 location_bar_->Init(); |
| 122 gtk_box_pack_start(GTK_BOX(toolbar_), location_bar_->widget(), TRUE, TRUE, 0); | 123 gtk_box_pack_start(GTK_BOX(toolbar_), location_bar_->widget(), TRUE, TRUE, 0); |
| 123 | 124 |
| 124 go_.reset(BuildToolbarButton(IDR_GO, IDR_GO_P, IDR_GO_H, 0, L"")); | 125 go_.reset(new GoButtonGtk(browser_)); |
| 126 gtk_box_pack_start(GTK_BOX(toolbar_), go_->widget(), FALSE, FALSE, 0); |
| 125 | 127 |
| 126 gtk_box_pack_start(GTK_BOX(toolbar_), gtk_label_new(" "), FALSE, FALSE, 0); | 128 gtk_box_pack_start(GTK_BOX(toolbar_), gtk_label_new(" "), FALSE, FALSE, 0); |
| 127 | 129 |
| 128 page_menu_button_.reset(BuildToolbarMenuButton(IDR_MENU_PAGE, | 130 page_menu_button_.reset(BuildToolbarMenuButton(IDR_MENU_PAGE, |
| 129 l10n_util::GetString(IDS_PAGEMENU_TOOLTIP))); | 131 l10n_util::GetString(IDS_PAGEMENU_TOOLTIP))); |
| 130 page_menu_.reset(new MenuGtk(this, GetStandardPageMenu(), accel_group_)); | 132 page_menu_.reset(new MenuGtk(this, GetStandardPageMenu(), accel_group_)); |
| 131 | 133 |
| 132 app_menu_button_.reset(BuildToolbarMenuButton(IDR_MENU_CHROME, | 134 app_menu_button_.reset(BuildToolbarMenuButton(IDR_MENU_CHROME, |
| 133 l10n_util::GetStringF(IDS_APPMENU_TOOLTIP, | 135 l10n_util::GetStringF(IDS_APPMENU_TOOLTIP, |
| 134 l10n_util::GetString(IDS_PRODUCT_NAME)))); | 136 l10n_util::GetString(IDS_PRODUCT_NAME)))); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // static | 280 // static |
| 279 void BrowserToolbarGtk::OnButtonClick(GtkWidget* button, | 281 void BrowserToolbarGtk::OnButtonClick(GtkWidget* button, |
| 280 BrowserToolbarGtk* toolbar) { | 282 BrowserToolbarGtk* toolbar) { |
| 281 int tag = -1; | 283 int tag = -1; |
| 282 if (button == toolbar->back_->widget()) | 284 if (button == toolbar->back_->widget()) |
| 283 tag = IDC_BACK; | 285 tag = IDC_BACK; |
| 284 else if (button == toolbar->forward_->widget()) | 286 else if (button == toolbar->forward_->widget()) |
| 285 tag = IDC_FORWARD; | 287 tag = IDC_FORWARD; |
| 286 else if (button == toolbar->reload_->widget()) | 288 else if (button == toolbar->reload_->widget()) |
| 287 tag = IDC_RELOAD; | 289 tag = IDC_RELOAD; |
| 288 else if (button == toolbar->go_->widget()) | |
| 289 tag = IDC_GO; | |
| 290 else if (toolbar->home_.get() && button == toolbar->home_->widget()) | 290 else if (toolbar->home_.get() && button == toolbar->home_->widget()) |
| 291 tag = IDC_HOME; | 291 tag = IDC_HOME; |
| 292 else if (button == toolbar->star_->widget()) | 292 else if (button == toolbar->star_->widget()) |
| 293 tag = IDC_STAR; | 293 tag = IDC_STAR; |
| 294 | 294 |
| 295 if (tag == IDC_BACK || tag == IDC_FORWARD) | 295 if (tag == IDC_BACK || tag == IDC_FORWARD) |
| 296 toolbar->show_menu_factory_.RevokeAll(); | 296 toolbar->show_menu_factory_.RevokeAll(); |
| 297 | 297 |
| 298 DCHECK(tag != -1) << "Impossible button click callback"; | 298 DCHECK_NE(tag, -1) << "Impossible button click callback"; |
| 299 toolbar->browser_->ExecuteCommand(tag); | 299 toolbar->browser_->ExecuteCommand(tag); |
| 300 } | 300 } |
| 301 | 301 |
| 302 // static | 302 // static |
| 303 gboolean BrowserToolbarGtk::OnMenuButtonPressEvent(GtkWidget* button, | 303 gboolean BrowserToolbarGtk::OnMenuButtonPressEvent(GtkWidget* button, |
| 304 GdkEvent* event, | 304 GdkEvent* event, |
| 305 BrowserToolbarGtk* toolbar) { | 305 BrowserToolbarGtk* toolbar) { |
| 306 // TODO(port): this never puts the button into the "active" state, | 306 // TODO(port): this never puts the button into the "active" state, |
| 307 // which means we never display the button-pressed-down graphics. I | 307 // which means we never display the button-pressed-down graphics. I |
| 308 // suspect a better way to do it is just to use a real GtkMenuShell | 308 // suspect a better way to do it is just to use a real GtkMenuShell |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 rb.LoadPixbuf(IDR_CONTENT_TOP_RIGHT_CORNER), | 405 rb.LoadPixbuf(IDR_CONTENT_TOP_RIGHT_CORNER), |
| 406 rb.LoadPixbuf(IDR_CONTENT_LEFT_SIDE), | 406 rb.LoadPixbuf(IDR_CONTENT_LEFT_SIDE), |
| 407 NULL, | 407 NULL, |
| 408 rb.LoadPixbuf(IDR_CONTENT_RIGHT_SIDE), | 408 rb.LoadPixbuf(IDR_CONTENT_RIGHT_SIDE), |
| 409 rb.LoadPixbuf(IDR_CONTENT_BOTTOM_LEFT_CORNER), | 409 rb.LoadPixbuf(IDR_CONTENT_BOTTOM_LEFT_CORNER), |
| 410 rb.LoadPixbuf(IDR_CONTENT_BOTTOM_CENTER), | 410 rb.LoadPixbuf(IDR_CONTENT_BOTTOM_CENTER), |
| 411 rb.LoadPixbuf(IDR_CONTENT_BOTTOM_RIGHT_CORNER) | 411 rb.LoadPixbuf(IDR_CONTENT_BOTTOM_RIGHT_CORNER) |
| 412 }; | 412 }; |
| 413 background_ninebox_.reset(new NineBox(images)); | 413 background_ninebox_.reset(new NineBox(images)); |
| 414 } | 414 } |
| OLD | NEW |