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

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

Issue 304933002: Revert of 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"
25 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h" 24 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
26 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h" 25 #include "chrome/browser/ui/libgtk2ui/native_theme_gtk2.h"
27 #include "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h" 26 #include "chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h"
28 #include "chrome/browser/ui/libgtk2ui/printing_gtk2_util.h" 27 #include "chrome/browser/ui/libgtk2ui/printing_gtk2_util.h"
29 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h" 28 #include "chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h"
30 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" 29 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h"
31 #include "chrome/browser/ui/libgtk2ui/unity_service.h" 30 #include "chrome/browser/ui/libgtk2ui/unity_service.h"
32 #include "chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h" 31 #include "chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h"
33 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
34 #include "grit/ui_resources.h" 33 #include "grit/ui_resources.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 if (unity::IsRunning()) 497 if (unity::IsRunning())
499 unity::SetDownloadCount(count); 498 unity::SetDownloadCount(count);
500 } 499 }
501 500
502 void Gtk2UI::SetProgressFraction(float percentage) const { 501 void Gtk2UI::SetProgressFraction(float percentage) const {
503 if (unity::IsRunning()) 502 if (unity::IsRunning())
504 unity::SetProgressFraction(percentage); 503 unity::SetProgressFraction(percentage);
505 } 504 }
506 505
507 bool Gtk2UI::IsStatusIconSupported() const { 506 bool Gtk2UI::IsStatusIconSupported() const {
508 return true; 507 return AppIndicatorIcon::CouldOpen();
509 } 508 }
510 509
511 scoped_ptr<views::StatusIconLinux> Gtk2UI::CreateLinuxStatusIcon( 510 scoped_ptr<views::StatusIconLinux> Gtk2UI::CreateLinuxStatusIcon(
512 const gfx::ImageSkia& image, 511 const gfx::ImageSkia& image,
513 const base::string16& tool_tip) const { 512 const base::string16& tool_tip) const {
514 if (AppIndicatorIcon::CouldOpen()) { 513 if (AppIndicatorIcon::CouldOpen()) {
515 ++indicators_count; 514 ++indicators_count;
516 return scoped_ptr<views::StatusIconLinux>(new AppIndicatorIcon( 515 return scoped_ptr<views::StatusIconLinux>(new AppIndicatorIcon(
517 base::StringPrintf("%s%d", kAppIndicatorIdPrefix, indicators_count), 516 base::StringPrintf("%s%d", kAppIndicatorIdPrefix, indicators_count),
518 image, 517 image,
519 tool_tip)); 518 tool_tip));
520 } else { 519 } else {
521 return scoped_ptr<views::StatusIconLinux>(new Gtk2StatusIcon( 520 return scoped_ptr<views::StatusIconLinux>();
522 image, tool_tip));
523 } 521 }
524 } 522 }
525 523
526 gfx::Image Gtk2UI::GetIconForContentType( 524 gfx::Image Gtk2UI::GetIconForContentType(
527 const std::string& content_type, 525 const std::string& content_type,
528 int size) const { 526 int size) const {
529 // This call doesn't take a reference. 527 // This call doesn't take a reference.
530 GtkIconTheme* theme = gtk_icon_theme_get_default(); 528 GtkIconTheme* theme = gtk_icon_theme_get_default();
531 529
532 std::string content_types[] = { 530 std::string content_types[] = {
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 ClearAllThemeData(); 1365 ClearAllThemeData();
1368 LoadGtkValues(); 1366 LoadGtkValues();
1369 NativeThemeGtk2::instance()->NotifyObservers(); 1367 NativeThemeGtk2::instance()->NotifyObservers();
1370 } 1368 }
1371 1369
1372 } // namespace libgtk2ui 1370 } // namespace libgtk2ui
1373 1371
1374 views::LinuxUI* BuildGtk2UI() { 1372 views::LinuxUI* BuildGtk2UI() {
1375 return new libgtk2ui::Gtk2UI; 1373 return new libgtk2ui::Gtk2UI;
1376 } 1374 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_status_icon.cc ('k') | chrome/browser/ui/libgtk2ui/libgtk2ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698