| 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 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/search_engines/template_url_service_factory.h" | 33 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 34 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
| 35 #include "chrome/browser/ui/browser_list.h" | 35 #include "chrome/browser/ui/browser_list.h" |
| 36 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 36 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 37 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 37 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
| 38 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" | 38 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" |
| 39 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 39 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 40 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" | 40 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" |
| 41 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" | 41 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
| 42 #include "chrome/browser/ui/gtk/first_run_bubble.h" | 42 #include "chrome/browser/ui/gtk/first_run_bubble.h" |
| 43 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 44 #include "chrome/browser/ui/gtk/gtk_util.h" | 43 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 45 #include "chrome/browser/ui/gtk/nine_box.h" | 44 #include "chrome/browser/ui/gtk/nine_box.h" |
| 46 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" | 45 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" |
| 47 #include "chrome/browser/ui/gtk/rounded_window.h" | 46 #include "chrome/browser/ui/gtk/rounded_window.h" |
| 47 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 48 #include "chrome/browser/ui/gtk/view_id_util.h" | 48 #include "chrome/browser/ui/gtk/view_id_util.h" |
| 49 #include "chrome/browser/ui/omnibox/location_bar_util.h" | 49 #include "chrome/browser/ui/omnibox/location_bar_util.h" |
| 50 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 50 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 51 #include "chrome/common/chrome_notification_types.h" | 51 #include "chrome/common/chrome_notification_types.h" |
| 52 #include "chrome/common/extensions/extension.h" | 52 #include "chrome/common/extensions/extension.h" |
| 53 #include "chrome/common/extensions/extension_action.h" | 53 #include "chrome/common/extensions/extension_action.h" |
| 54 #include "chrome/common/extensions/extension_resource.h" | 54 #include "chrome/common/extensions/extension_resource.h" |
| 55 #include "chrome/common/pref_names.h" | 55 #include "chrome/common/pref_names.h" |
| 56 #include "content/public/browser/navigation_entry.h" | 56 #include "content/public/browser/navigation_entry.h" |
| 57 #include "content/public/browser/notification_service.h" | 57 #include "content/public/browser/notification_service.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 star_.Destroy(); | 184 star_.Destroy(); |
| 185 hbox_.Destroy(); | 185 hbox_.Destroy(); |
| 186 content_setting_hbox_.Destroy(); | 186 content_setting_hbox_.Destroy(); |
| 187 page_action_hbox_.Destroy(); | 187 page_action_hbox_.Destroy(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void LocationBarViewGtk::Init(bool popup_window_mode) { | 190 void LocationBarViewGtk::Init(bool popup_window_mode) { |
| 191 popup_window_mode_ = popup_window_mode; | 191 popup_window_mode_ = popup_window_mode; |
| 192 | 192 |
| 193 Profile* profile = browser_->profile(); | 193 Profile* profile = browser_->profile(); |
| 194 theme_service_ = GtkThemeService::GetFrom(profile); | 194 theme_service_ = ThemeServiceGtk::GetFrom(profile); |
| 195 | 195 |
| 196 // Create the widget first, so we can pass it to the OmniboxViewGtk. | 196 // Create the widget first, so we can pass it to the OmniboxViewGtk. |
| 197 hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding)); | 197 hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding)); |
| 198 gtk_container_set_border_width(GTK_CONTAINER(hbox_.get()), kHboxBorder); | 198 gtk_container_set_border_width(GTK_CONTAINER(hbox_.get()), kHboxBorder); |
| 199 // We will paint for the alignment, to paint the background and border. | 199 // We will paint for the alignment, to paint the background and border. |
| 200 gtk_widget_set_app_paintable(hbox_.get(), TRUE); | 200 gtk_widget_set_app_paintable(hbox_.get(), TRUE); |
| 201 // Redraw the whole location bar when it changes size (e.g., when toggling | 201 // Redraw the whole location bar when it changes size (e.g., when toggling |
| 202 // the home button on/off. | 202 // the home button on/off. |
| 203 gtk_widget_set_redraw_on_allocate(hbox_.get(), TRUE); | 203 gtk_widget_set_redraw_on_allocate(hbox_.get(), TRUE); |
| 204 | 204 |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 | 818 |
| 819 UpdateStarIcon(); | 819 UpdateStarIcon(); |
| 820 UpdateSiteTypeArea(); | 820 UpdateSiteTypeArea(); |
| 821 UpdateContentSettingsIcons(); | 821 UpdateContentSettingsIcons(); |
| 822 } | 822 } |
| 823 | 823 |
| 824 gboolean LocationBarViewGtk::HandleExpose(GtkWidget* widget, | 824 gboolean LocationBarViewGtk::HandleExpose(GtkWidget* widget, |
| 825 GdkEventExpose* event) { | 825 GdkEventExpose* event) { |
| 826 // If we're not using GTK theming, draw our own border over the edge pixels | 826 // If we're not using GTK theming, draw our own border over the edge pixels |
| 827 // of the background. | 827 // of the background. |
| 828 if (!GtkThemeService::GetFrom(browser_->profile())->UsingNativeTheme()) { | 828 if (!ThemeServiceGtk::GetFrom(browser_->profile())->UsingNativeTheme()) { |
| 829 int left, center, right; | 829 int left, center, right; |
| 830 if (popup_window_mode_) { | 830 if (popup_window_mode_) { |
| 831 left = right = IDR_LOCATIONBG_POPUPMODE_EDGE; | 831 left = right = IDR_LOCATIONBG_POPUPMODE_EDGE; |
| 832 center = IDR_LOCATIONBG_POPUPMODE_CENTER; | 832 center = IDR_LOCATIONBG_POPUPMODE_CENTER; |
| 833 } else { | 833 } else { |
| 834 left = IDR_LOCATIONBG_L; | 834 left = IDR_LOCATIONBG_L; |
| 835 center = IDR_LOCATIONBG_C; | 835 center = IDR_LOCATIONBG_C; |
| 836 right = IDR_LOCATIONBG_R; | 836 right = IDR_LOCATIONBG_R; |
| 837 } | 837 } |
| 838 | 838 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 | 1281 |
| 1282 void LocationBarViewGtk::ContentSettingImageViewGtk::UpdateFromWebContents( | 1282 void LocationBarViewGtk::ContentSettingImageViewGtk::UpdateFromWebContents( |
| 1283 WebContents* web_contents) { | 1283 WebContents* web_contents) { |
| 1284 content_setting_image_model_->UpdateFromWebContents(web_contents); | 1284 content_setting_image_model_->UpdateFromWebContents(web_contents); |
| 1285 if (!content_setting_image_model_->is_visible()) { | 1285 if (!content_setting_image_model_->is_visible()) { |
| 1286 gtk_widget_hide(widget()); | 1286 gtk_widget_hide(widget()); |
| 1287 return; | 1287 return; |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()), | 1290 gtk_image_set_from_pixbuf(GTK_IMAGE(image_.get()), |
| 1291 GtkThemeService::GetFrom(parent_->browser()->profile())->GetImageNamed( | 1291 ThemeServiceGtk::GetFrom(parent_->browser()->profile())->GetImageNamed( |
| 1292 content_setting_image_model_->get_icon())->ToGdkPixbuf()); | 1292 content_setting_image_model_->get_icon())->ToGdkPixbuf()); |
| 1293 | 1293 |
| 1294 gtk_widget_set_tooltip_text(widget(), | 1294 gtk_widget_set_tooltip_text(widget(), |
| 1295 content_setting_image_model_->get_tooltip().c_str()); | 1295 content_setting_image_model_->get_tooltip().c_str()); |
| 1296 gtk_widget_show_all(widget()); | 1296 gtk_widget_show_all(widget()); |
| 1297 | 1297 |
| 1298 TabSpecificContentSettings* content_settings = NULL; | 1298 TabSpecificContentSettings* content_settings = NULL; |
| 1299 if (web_contents) { | 1299 if (web_contents) { |
| 1300 content_settings = TabContentsWrapper::GetCurrentWrapperForContents( | 1300 content_settings = TabContentsWrapper::GetCurrentWrapperForContents( |
| 1301 web_contents)->content_settings(); | 1301 web_contents)->content_settings(); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 std::string badge_text = page_action_->GetBadgeText(tab_id); | 1646 std::string badge_text = page_action_->GetBadgeText(tab_id); |
| 1647 if (badge_text.empty()) | 1647 if (badge_text.empty()) |
| 1648 return FALSE; | 1648 return FALSE; |
| 1649 | 1649 |
| 1650 gfx::CanvasSkiaPaint canvas(event, false); | 1650 gfx::CanvasSkiaPaint canvas(event, false); |
| 1651 GtkAllocation allocation; | 1651 GtkAllocation allocation; |
| 1652 gtk_widget_get_allocation(widget, &allocation); | 1652 gtk_widget_get_allocation(widget, &allocation); |
| 1653 page_action_->PaintBadge(&canvas, gfx::Rect(allocation), tab_id); | 1653 page_action_->PaintBadge(&canvas, gfx::Rect(allocation), tab_id); |
| 1654 return FALSE; | 1654 return FALSE; |
| 1655 } | 1655 } |
| OLD | NEW |