Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 306063003: Reland: Fall back to X11 system tray icons if libappindicator is not available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/libgtk2ui/gtk2_ui.h" 5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
11 #include "base/environment.h" 11 #include "base/environment.h"
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/nix/mime_util_xdg.h" 14 #include "base/nix/mime_util_xdg.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "chrome/browser/themes/theme_properties.h" 17 #include "chrome/browser/themes/theme_properties.h"
18 #include "chrome/browser/ui/libgtk2ui/app_indicator_icon.h" 18 #include "chrome/browser/ui/libgtk2ui/app_indicator_icon.h"
19 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h" 19 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h"
20 #include "chrome/browser/ui/libgtk2ui/gtk2_border.h" 20 #include "chrome/browser/ui/libgtk2ui/gtk2_border.h"
21 #include "chrome/browser/ui/libgtk2ui/gtk2_event_loop.h" 21 #include "chrome/browser/ui/libgtk2ui/gtk2_event_loop.h"
22 #include "chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h" 22 #include "chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h"
23 #include "chrome/browser/ui/libgtk2ui/gtk2_signal_registrar.h" 23 #include "chrome/browser/ui/libgtk2ui/gtk2_signal_registrar.h"
24 #include "chrome/browser/ui/libgtk2ui/gtk2_status_icon.h"
24 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" 25 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
25 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h" 26 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h"
26 #include "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h" 27 #include "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h"
27 #include "chrome/browser/ui/libgtk2ui/printing_gtk2_util.h" 28 #include "chrome/browser/ui/libgtk2ui/printing_gtk2_util.h"
28 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h" 29 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h"
29 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" 30 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h"
30 #include "chrome/browser/ui/libgtk2ui/unity_service.h" 31 #include "chrome/browser/ui/libgtk2ui/unity_service.h"
31 #include "chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h" 32 #include "chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h"
32 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
33 #include "grit/ui_resources.h" 34 #include "grit/ui_resources.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 if (unity::IsRunning()) 498 if (unity::IsRunning())
498 unity::SetDownloadCount(count); 499 unity::SetDownloadCount(count);
499 } 500 }
500 501
501 void Gtk2UI::SetProgressFraction(float percentage) const { 502 void Gtk2UI::SetProgressFraction(float percentage) const {
502 if (unity::IsRunning()) 503 if (unity::IsRunning())
503 unity::SetProgressFraction(percentage); 504 unity::SetProgressFraction(percentage);
504 } 505 }
505 506
506 bool Gtk2UI::IsStatusIconSupported() const { 507 bool Gtk2UI::IsStatusIconSupported() const {
507 return AppIndicatorIcon::CouldOpen(); 508 return true;
508 } 509 }
509 510
510 scoped_ptr<views::StatusIconLinux> Gtk2UI::CreateLinuxStatusIcon( 511 scoped_ptr<views::StatusIconLinux> Gtk2UI::CreateLinuxStatusIcon(
511 const gfx::ImageSkia& image, 512 const gfx::ImageSkia& image,
512 const base::string16& tool_tip) const { 513 const base::string16& tool_tip) const {
513 if (AppIndicatorIcon::CouldOpen()) { 514 if (AppIndicatorIcon::CouldOpen()) {
514 ++indicators_count; 515 ++indicators_count;
515 return scoped_ptr<views::StatusIconLinux>(new AppIndicatorIcon( 516 return scoped_ptr<views::StatusIconLinux>(new AppIndicatorIcon(
516 base::StringPrintf("%s%d", kAppIndicatorIdPrefix, indicators_count), 517 base::StringPrintf("%s%d", kAppIndicatorIdPrefix, indicators_count),
517 image, 518 image,
518 tool_tip)); 519 tool_tip));
519 } else { 520 } else {
520 return scoped_ptr<views::StatusIconLinux>(); 521 return scoped_ptr<views::StatusIconLinux>(new Gtk2StatusIcon(
522 image, tool_tip));
521 } 523 }
522 } 524 }
523 525
524 gfx::Image Gtk2UI::GetIconForContentType( 526 gfx::Image Gtk2UI::GetIconForContentType(
525 const std::string& content_type, 527 const std::string& content_type,
526 int size) const { 528 int size) const {
527 // This call doesn't take a reference. 529 // This call doesn't take a reference.
528 GtkIconTheme* theme = gtk_icon_theme_get_default(); 530 GtkIconTheme* theme = gtk_icon_theme_get_default();
529 531
530 std::string content_types[] = { 532 std::string content_types[] = {
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 ClearAllThemeData(); 1367 ClearAllThemeData();
1366 LoadGtkValues(); 1368 LoadGtkValues();
1367 NativeThemeGtk2::instance()->NotifyObservers(); 1369 NativeThemeGtk2::instance()->NotifyObservers();
1368 } 1370 }
1369 1371
1370 } // namespace libgtk2ui 1372 } // namespace libgtk2ui
1371 1373
1372 views::LinuxUI* BuildGtk2UI() { 1374 views::LinuxUI* BuildGtk2UI() {
1373 return new libgtk2ui::Gtk2UI; 1375 return new libgtk2ui::Gtk2UI;
1374 } 1376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698