| 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/gtk_theme_service.h" | 29 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 30 #include "content/browser/disposition_utils.h" | 30 #include "content/browser/disposition_utils.h" |
| 31 #include "content/browser/renderer_host/render_view_host.h" | 31 #include "content/browser/renderer_host/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" |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 if (text_utf8.length() > 2000) | 908 if (text_utf8.length() > 2000) |
| 909 text_utf8 = text_utf8.substr(0, 2000); | 909 text_utf8 = text_utf8.substr(0, 2000); |
| 910 | 910 |
| 911 pango_layout_set_text(layout, text_utf8.data(), text_utf8.length()); | 911 pango_layout_set_text(layout, text_utf8.data(), text_utf8.length()); |
| 912 } | 912 } |
| 913 | 913 |
| 914 void DrawThemedToolbarBackground(GtkWidget* widget, | 914 void DrawThemedToolbarBackground(GtkWidget* widget, |
| 915 cairo_t* cr, | 915 cairo_t* cr, |
| 916 GdkEventExpose* event, | 916 GdkEventExpose* event, |
| 917 const gfx::Point& tabstrip_origin, | 917 const gfx::Point& tabstrip_origin, |
| 918 GtkThemeService* theme_service) { | 918 ThemeServiceGtk* theme_service) { |
| 919 // Fill the entire region with the toolbar color. | 919 // Fill the entire region with the toolbar color. |
| 920 GdkColor color = theme_service->GetGdkColor( | 920 GdkColor color = theme_service->GetGdkColor( |
| 921 ThemeService::COLOR_TOOLBAR); | 921 ThemeService::COLOR_TOOLBAR); |
| 922 gdk_cairo_set_source_color(cr, &color); | 922 gdk_cairo_set_source_color(cr, &color); |
| 923 cairo_fill(cr); | 923 cairo_fill(cr); |
| 924 | 924 |
| 925 // The toolbar is supposed to blend in with the active tab, so we have to pass | 925 // The toolbar is supposed to blend in with the active tab, so we have to pass |
| 926 // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the | 926 // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the |
| 927 // tab strip. | 927 // tab strip. |
| 928 const gfx::Image* background = | 928 const gfx::Image* background = |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 | 1322 |
| 1323 void DoCopy(BrowserWindow* window) { | 1323 void DoCopy(BrowserWindow* window) { |
| 1324 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); | 1324 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 void DoPaste(BrowserWindow* window) { | 1327 void DoPaste(BrowserWindow* window) { |
| 1328 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); | 1328 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); |
| 1329 } | 1329 } |
| 1330 | 1330 |
| 1331 } // namespace gtk_util | 1331 } // namespace gtk_util |
| OLD | NEW |