| 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/gtk_util.h" | 5 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 6 | 6 |
| 7 #include <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cstdarg> | 10 #include <cstdarg> |
| 11 #include <map> | 11 #include <map> |
| 12 | 12 |
| 13 #include "base/environment.h" | 13 #include "base/environment.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/nix/xdg_util.h" | 16 #include "base/nix/xdg_util.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete.h" | 19 #include "chrome/browser/autocomplete/autocomplete.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 21 #include "chrome/browser/autocomplete/autocomplete_match.h" | 21 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/event_disposition.h" | 23 #include "chrome/browser/event_disposition.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/profiles/profile_info_cache.h" | 25 #include "chrome/browser/profiles/profile_info_cache.h" |
| 26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 27 #include "chrome/browser/ui/browser_list.h" | 27 #include "chrome/browser/ui/browser_list.h" |
| 28 #include "chrome/browser/ui/browser_window.h" | 28 #include "chrome/browser/ui/browser_window.h" |
| 29 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 29 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 30 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | 30 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 31 #include "content/public/browser/render_view_host.h" | 31 #include "content/public/browser/render_view_host.h" |
| 32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
| 33 #include "content/public/common/renderer_preferences.h" | 33 #include "content/public/common/renderer_preferences.h" |
| 34 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
| 35 #include "grit/theme_resources.h" | 35 #include "grit/theme_resources.h" |
| 36 #include "grit/theme_resources_standard.h" | 36 #include "grit/theme_resources_standard.h" |
| 37 #include "ui/base/events.h" | 37 #include "ui/base/events.h" |
| 38 #include "ui/base/gtk/gtk_compat.h" | 38 #include "ui/base/gtk/gtk_compat.h" |
| 39 #include "ui/base/gtk/gtk_hig_constants.h" | 39 #include "ui/base/gtk/gtk_hig_constants.h" |
| 40 #include "ui/base/gtk/gtk_screen_util.h" | 40 #include "ui/base/gtk/gtk_screen_util.h" |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 if (text_utf8.length() > 2000) | 848 if (text_utf8.length() > 2000) |
| 849 text_utf8 = text_utf8.substr(0, 2000); | 849 text_utf8 = text_utf8.substr(0, 2000); |
| 850 | 850 |
| 851 pango_layout_set_text(layout, text_utf8.data(), text_utf8.length()); | 851 pango_layout_set_text(layout, text_utf8.data(), text_utf8.length()); |
| 852 } | 852 } |
| 853 | 853 |
| 854 void DrawThemedToolbarBackground(GtkWidget* widget, | 854 void DrawThemedToolbarBackground(GtkWidget* widget, |
| 855 cairo_t* cr, | 855 cairo_t* cr, |
| 856 GdkEventExpose* event, | 856 GdkEventExpose* event, |
| 857 const gfx::Point& tabstrip_origin, | 857 const gfx::Point& tabstrip_origin, |
| 858 ThemeServiceGtk* theme_service) { | 858 GtkThemeService* theme_service) { |
| 859 // Fill the entire region with the toolbar color. | 859 // Fill the entire region with the toolbar color. |
| 860 GdkColor color = theme_service->GetGdkColor( | 860 GdkColor color = theme_service->GetGdkColor( |
| 861 ThemeService::COLOR_TOOLBAR); | 861 ThemeService::COLOR_TOOLBAR); |
| 862 gdk_cairo_set_source_color(cr, &color); | 862 gdk_cairo_set_source_color(cr, &color); |
| 863 cairo_fill(cr); | 863 cairo_fill(cr); |
| 864 | 864 |
| 865 // The toolbar is supposed to blend in with the active tab, so we have to pass | 865 // The toolbar is supposed to blend in with the active tab, so we have to pass |
| 866 // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the | 866 // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the |
| 867 // tab strip. | 867 // tab strip. |
| 868 const gfx::Image* background = | 868 const gfx::Image* background = |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 | 1157 |
| 1158 void DoCopy(BrowserWindow* window) { | 1158 void DoCopy(BrowserWindow* window) { |
| 1159 DoCutCopyPaste(window, &RenderWidgetHost::Copy, "copy-clipboard"); | 1159 DoCutCopyPaste(window, &RenderWidgetHost::Copy, "copy-clipboard"); |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 void DoPaste(BrowserWindow* window) { | 1162 void DoPaste(BrowserWindow* window) { |
| 1163 DoCutCopyPaste(window, &RenderWidgetHost::Paste, "paste-clipboard"); | 1163 DoCutCopyPaste(window, &RenderWidgetHost::Paste, "paste-clipboard"); |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 } // namespace gtk_util | 1166 } // namespace gtk_util |
| OLD | NEW |