| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/location_bar_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "chrome/browser/ui/browser_list.h" | 38 #include "chrome/browser/ui/browser_list.h" |
| 39 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 39 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 40 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 40 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
| 41 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" | 41 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" |
| 42 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 42 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 43 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 43 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 44 #include "chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h" | 44 #include "chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h" |
| 45 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" | 45 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" |
| 46 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" | 46 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
| 47 #include "chrome/browser/ui/gtk/first_run_bubble.h" | 47 #include "chrome/browser/ui/gtk/first_run_bubble.h" |
| 48 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 48 #include "chrome/browser/ui/gtk/gtk_util.h" | 49 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 49 #include "chrome/browser/ui/gtk/nine_box.h" | 50 #include "chrome/browser/ui/gtk/nine_box.h" |
| 50 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" | 51 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" |
| 51 #include "chrome/browser/ui/gtk/rounded_window.h" | 52 #include "chrome/browser/ui/gtk/rounded_window.h" |
| 52 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | |
| 53 #include "chrome/browser/ui/gtk/view_id_util.h" | 53 #include "chrome/browser/ui/gtk/view_id_util.h" |
| 54 #include "chrome/browser/ui/omnibox/location_bar_util.h" | 54 #include "chrome/browser/ui/omnibox/location_bar_util.h" |
| 55 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 55 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 56 #include "chrome/common/chrome_notification_types.h" | 56 #include "chrome/common/chrome_notification_types.h" |
| 57 #include "chrome/common/extensions/extension.h" | 57 #include "chrome/common/extensions/extension.h" |
| 58 #include "chrome/common/extensions/extension_action.h" | 58 #include "chrome/common/extensions/extension_action.h" |
| 59 #include "chrome/common/extensions/extension_manifest_constants.h" | 59 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 60 #include "chrome/common/extensions/extension_resource.h" | 60 #include "chrome/common/extensions/extension_resource.h" |
| 61 #include "chrome/common/pref_names.h" | 61 #include "chrome/common/pref_names.h" |
| 62 #include "content/public/browser/navigation_entry.h" | 62 #include "content/public/browser/navigation_entry.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 chrome_to_mobile_view_.Destroy(); | 193 chrome_to_mobile_view_.Destroy(); |
| 194 hbox_.Destroy(); | 194 hbox_.Destroy(); |
| 195 content_setting_hbox_.Destroy(); | 195 content_setting_hbox_.Destroy(); |
| 196 page_action_hbox_.Destroy(); | 196 page_action_hbox_.Destroy(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void LocationBarViewGtk::Init(bool popup_window_mode) { | 199 void LocationBarViewGtk::Init(bool popup_window_mode) { |
| 200 popup_window_mode_ = popup_window_mode; | 200 popup_window_mode_ = popup_window_mode; |
| 201 | 201 |
| 202 Profile* profile = browser_->profile(); | 202 Profile* profile = browser_->profile(); |
| 203 theme_service_ = ThemeServiceGtk::GetFrom(profile); | 203 theme_service_ = GtkThemeService::GetFrom(profile); |
| 204 | 204 |
| 205 // Create the widget first, so we can pass it to the OmniboxViewGtk. | 205 // Create the widget first, so we can pass it to the OmniboxViewGtk. |
| 206 hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding)); | 206 hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding)); |
| 207 gtk_container_set_border_width(GTK_CONTAINER(hbox_.get()), kHboxBorder); | 207 gtk_container_set_border_width(GTK_CONTAINER(hbox_.get()), kHboxBorder); |
| 208 // We will paint for the alignment, to paint the background and border. | 208 // We will paint for the alignment, to paint the background and border. |
| 209 gtk_widget_set_app_paintable(hbox_.get(), TRUE); | 209 gtk_widget_set_app_paintable(hbox_.get(), TRUE); |
| 210 // Redraw the whole location bar when it changes size (e.g., when toggling | 210 // Redraw the whole location bar when it changes size (e.g., when toggling |
| 211 // the home button on/off. | 211 // the home button on/off. |
| 212 gtk_widget_set_redraw_on_allocate(hbox_.get(), TRUE); | 212 gtk_widget_set_redraw_on_allocate(hbox_.get(), TRUE); |
| 213 | 213 |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 UpdateStarIcon(); | 861 UpdateStarIcon(); |
| 862 UpdateChromeToMobileIcon(); | 862 UpdateChromeToMobileIcon(); |
| 863 UpdateSiteTypeArea(); | 863 UpdateSiteTypeArea(); |
| 864 UpdateContentSettingsIcons(); | 864 UpdateContentSettingsIcons(); |
| 865 } | 865 } |
| 866 | 866 |
| 867 gboolean LocationBarViewGtk::HandleExpose(GtkWidget* widget, | 867 gboolean LocationBarViewGtk::HandleExpose(GtkWidget* widget, |
| 868 GdkEventExpose* event) { | 868 GdkEventExpose* event) { |
| 869 // If we're not using GTK theming, draw our own border over the edge pixels | 869 // If we're not using GTK theming, draw our own border over the edge pixels |
| 870 // of the background. | 870 // of the background. |
| 871 if (!ThemeServiceGtk::GetFrom(browser_->profile())->UsingNativeTheme()) { | 871 if (!GtkThemeService::GetFrom(browser_->profile())->UsingNativeTheme()) { |
| 872 int left, center, right; | 872 int left, center, right; |
| 873 if (popup_window_mode_) { | 873 if (popup_window_mode_) { |
| 874 left = right = IDR_LOCATIONBG_POPUPMODE_EDGE; | 874 left = right = IDR_LOCATIONBG_POPUPMODE_EDGE; |
| 875 center = IDR_LOCATIONBG_POPUPMODE_CENTER; | 875 center = IDR_LOCATIONBG_POPUPMODE_CENTER; |
| 876 } else { | 876 } else { |
| 877 left = IDR_LOCATIONBG_L; | 877 left = IDR_LOCATIONBG_L; |
| 878 center = IDR_LOCATIONBG_C; | 878 center = IDR_LOCATIONBG_C; |
| 879 right = IDR_LOCATIONBG_R; | 879 right = IDR_LOCATIONBG_R; |
| 880 } | 880 } |
| 881 | 881 |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 | 1347 |
| 1348 void LocationBarViewGtk::ContentSettingImageViewGtk::UpdateFromWebContents( | 1348 void LocationBarViewGtk::ContentSettingImageViewGtk::UpdateFromWebContents( |
| 1349 WebContents* web_contents) { | 1349 WebContents* web_contents) { |
| 1350 content_setting_image_model_->UpdateFromWebContents(web_contents); | 1350 content_setting_image_model_->UpdateFromWebContents(web_contents); |
| 1351 if (!content_setting_image_model_->is_visible()) { | 1351 if (!content_setting_image_model_->is_visible()) { |
| 1352 gtk_widget_hide(widget()); | 1352 gtk_widget_hide(widget()); |
| 1353 return; | 1353 return; |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()), | 1356 gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()), |
| 1357 ThemeServiceGtk::GetFrom(parent_->browser()->profile())->GetImageNamed( | 1357 GtkThemeService::GetFrom(parent_->browser()->profile())->GetImageNamed( |
| 1358 content_setting_image_model_->get_icon())->ToGdkPixbuf()); | 1358 content_setting_image_model_->get_icon())->ToGdkPixbuf()); |
| 1359 | 1359 |
| 1360 gtk_widget_set_tooltip_text(widget(), | 1360 gtk_widget_set_tooltip_text(widget(), |
| 1361 content_setting_image_model_->get_tooltip().c_str()); | 1361 content_setting_image_model_->get_tooltip().c_str()); |
| 1362 gtk_widget_show_all(widget()); | 1362 gtk_widget_show_all(widget()); |
| 1363 | 1363 |
| 1364 TabSpecificContentSettings* content_settings = NULL; | 1364 TabSpecificContentSettings* content_settings = NULL; |
| 1365 if (web_contents) { | 1365 if (web_contents) { |
| 1366 content_settings = TabContentsWrapper::GetCurrentWrapperForContents( | 1366 content_settings = TabContentsWrapper::GetCurrentWrapperForContents( |
| 1367 web_contents)->content_settings(); | 1367 web_contents)->content_settings(); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 GdkModifierType modifier, | 1800 GdkModifierType modifier, |
| 1801 void* user_data) { | 1801 void* user_data) { |
| 1802 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); | 1802 PageActionViewGtk* view = static_cast<PageActionViewGtk*>(user_data); |
| 1803 if (!gtk_widget_get_visible(view->widget())) | 1803 if (!gtk_widget_get_visible(view->widget())) |
| 1804 return FALSE; | 1804 return FALSE; |
| 1805 | 1805 |
| 1806 GdkEventButton event = {}; | 1806 GdkEventButton event = {}; |
| 1807 event.button = 1; | 1807 event.button = 1; |
| 1808 return view->OnButtonPressed(view->widget(), &event); | 1808 return view->OnButtonPressed(view->widget(), &event); |
| 1809 } | 1809 } |
| OLD | NEW |