| 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/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 19 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 20 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.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/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/profiles/profile_info_cache.h" | 24 #include "chrome/browser/profiles/profile_info_cache.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/profiles/profile_manager_util.h" |
| 26 #include "chrome/browser/themes/theme_properties.h" | 27 #include "chrome/browser/themes/theme_properties.h" |
| 27 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_iterator.h" | 29 #include "chrome/browser/ui/browser_iterator.h" |
| 29 #include "chrome/browser/ui/browser_list.h" | 30 #include "chrome/browser/ui/browser_list.h" |
| 30 #include "chrome/browser/ui/browser_window.h" | 31 #include "chrome/browser/ui/browser_window.h" |
| 31 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 32 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 32 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 33 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 33 #include "chrome/browser/ui/host_desktop.h" | 34 #include "chrome/browser/ui/host_desktop.h" |
| 34 #include "grit/chrome_unscaled_resources.h" | 35 #include "grit/chrome_unscaled_resources.h" |
| 35 #include "grit/theme_resources.h" | 36 #include "grit/theme_resources.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // either the resource bundle or the profile info cache. | 145 // either the resource bundle or the profile info cache. |
| 145 GdkPixbuf* GetAvatarIcon(Profile* profile) { | 146 GdkPixbuf* GetAvatarIcon(Profile* profile) { |
| 146 if (profile->IsOffTheRecord()) { | 147 if (profile->IsOffTheRecord()) { |
| 147 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 148 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 148 return rb.GetNativeImageNamed(IDR_OTR_ICON).ToGdkPixbuf(); | 149 return rb.GetNativeImageNamed(IDR_OTR_ICON).ToGdkPixbuf(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 const ProfileInfoCache& cache = | 152 const ProfileInfoCache& cache = |
| 152 g_browser_process->profile_manager()->GetProfileInfoCache(); | 153 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 153 | 154 |
| 154 if (!ProfileManager::IsMultipleProfilesEnabled() || | 155 if (!profiles::IsMultipleProfilesEnabled() || |
| 155 cache.GetNumberOfProfiles() < 2) | 156 cache.GetNumberOfProfiles() < 2) |
| 156 return NULL; | 157 return NULL; |
| 157 | 158 |
| 158 const size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 159 const size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
| 159 | 160 |
| 160 return (index != std::string::npos ? | 161 return (index != std::string::npos ? |
| 161 cache.GetAvatarIconOfProfileAtIndex(index).ToGdkPixbuf() : | 162 cache.GetAvatarIconOfProfileAtIndex(index).ToGdkPixbuf() : |
| 162 static_cast<GdkPixbuf*>(NULL)); | 163 static_cast<GdkPixbuf*>(NULL)); |
| 163 } | 164 } |
| 164 | 165 |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 if (gtk_window_get_modal(GTK_WINDOW(dialog))) { | 993 if (gtk_window_get_modal(GTK_WINDOW(dialog))) { |
| 993 // Work around a KDE 3 window manager bug. | 994 // Work around a KDE 3 window manager bug. |
| 994 scoped_ptr<base::Environment> env(base::Environment::Create()); | 995 scoped_ptr<base::Environment> env(base::Environment::Create()); |
| 995 if (base::nix::DESKTOP_ENVIRONMENT_KDE3 == | 996 if (base::nix::DESKTOP_ENVIRONMENT_KDE3 == |
| 996 base::nix::GetDesktopEnvironment(env.get())) | 997 base::nix::GetDesktopEnvironment(env.get())) |
| 997 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE); | 998 gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE); |
| 998 } | 999 } |
| 999 } | 1000 } |
| 1000 | 1001 |
| 1001 } // namespace gtk_util | 1002 } // namespace gtk_util |
| OLD | NEW |