OLD | NEW |
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/ui/gtk/browser_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
6 | 6 |
7 #include <X11/XF86keysym.h> | 7 #include <X11/XF86keysym.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/ui/gtk/custom_button.h" | 28 #include "chrome/browser/ui/gtk/custom_button.h" |
29 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 29 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
30 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 30 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
31 #include "chrome/browser/ui/gtk/gtk_util.h" | 31 #include "chrome/browser/ui/gtk/gtk_util.h" |
32 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 32 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
33 #include "chrome/browser/ui/gtk/reload_button_gtk.h" | 33 #include "chrome/browser/ui/gtk/reload_button_gtk.h" |
34 #include "chrome/browser/ui/gtk/rounded_window.h" | 34 #include "chrome/browser/ui/gtk/rounded_window.h" |
35 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 35 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
36 #include "chrome/browser/ui/gtk/view_id_util.h" | 36 #include "chrome/browser/ui/gtk/view_id_util.h" |
37 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 37 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| 38 #include "chrome/browser/ui/webui/web_ui_util.h" |
38 #include "chrome/browser/upgrade_detector.h" | 39 #include "chrome/browser/upgrade_detector.h" |
39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
40 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
41 #include "content/browser/tab_contents/tab_contents.h" | 42 #include "content/browser/tab_contents/tab_contents.h" |
42 #include "content/browser/user_metrics.h" | 43 #include "content/browser/user_metrics.h" |
43 #include "content/common/notification_details.h" | 44 #include "content/common/notification_details.h" |
44 #include "content/common/notification_service.h" | 45 #include "content/common/notification_service.h" |
45 #include "content/common/notification_type.h" | 46 #include "content/common/notification_type.h" |
46 #include "grit/chromium_strings.h" | 47 #include "grit/chromium_strings.h" |
47 #include "grit/generated_resources.h" | 48 #include "grit/generated_resources.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 GtkSelectionData* data, guint info, guint time) { | 600 GtkSelectionData* data, guint info, guint time) { |
600 if (info != ui::TEXT_PLAIN) { | 601 if (info != ui::TEXT_PLAIN) { |
601 NOTIMPLEMENTED() << "Only support plain text drops for now, sorry!"; | 602 NOTIMPLEMENTED() << "Only support plain text drops for now, sorry!"; |
602 return; | 603 return; |
603 } | 604 } |
604 | 605 |
605 GURL url(reinterpret_cast<char*>(data->data)); | 606 GURL url(reinterpret_cast<char*>(data->data)); |
606 if (!url.is_valid()) | 607 if (!url.is_valid()) |
607 return; | 608 return; |
608 | 609 |
609 bool url_is_newtab = url.SchemeIs(chrome::kChromeUIScheme) && | 610 bool url_is_newtab = |
610 url.host() == chrome::kChromeUINewTabHost; | 611 web_ui_util::ChromeURLHostEquals(url, chrome::kChromeUINewTabHost); |
611 home_page_is_new_tab_page_.SetValue(url_is_newtab); | 612 home_page_is_new_tab_page_.SetValue(url_is_newtab); |
612 if (!url_is_newtab) | 613 if (!url_is_newtab) |
613 home_page_.SetValue(url.spec()); | 614 home_page_.SetValue(url.spec()); |
614 } | 615 } |
615 | 616 |
616 void BrowserToolbarGtk::NotifyPrefChanged(const std::string* pref) { | 617 void BrowserToolbarGtk::NotifyPrefChanged(const std::string* pref) { |
617 if (!pref || *pref == prefs::kShowHomeButton) { | 618 if (!pref || *pref == prefs::kShowHomeButton) { |
618 if (show_home_button_.GetValue() && !ShouldOnlyShowLocation()) { | 619 if (show_home_button_.GetValue() && !ShouldOnlyShowLocation()) { |
619 gtk_widget_show(home_->widget()); | 620 gtk_widget_show(home_->widget()); |
620 } else { | 621 } else { |
(...skipping 29 matching lines...) Expand all Loading... |
650 int x_offset = base::i18n::IsRTL() ? 0 : | 651 int x_offset = base::i18n::IsRTL() ? 0 : |
651 sender->allocation.width - badge->width(); | 652 sender->allocation.width - badge->width(); |
652 int y_offset = 0; | 653 int y_offset = 0; |
653 canvas.DrawBitmapInt( | 654 canvas.DrawBitmapInt( |
654 *badge, | 655 *badge, |
655 sender->allocation.x + x_offset, | 656 sender->allocation.x + x_offset, |
656 sender->allocation.y + y_offset); | 657 sender->allocation.y + y_offset); |
657 | 658 |
658 return FALSE; | 659 return FALSE; |
659 } | 660 } |
OLD | NEW |