OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
6 | 6 |
7 #include <X11/XF86keysym.h> | 7 #include <X11/XF86keysym.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 browser_(browser), | 93 browser_(browser), |
94 window_(window) { | 94 window_(window) { |
95 browser_->command_updater()->AddCommandObserver(IDC_BACK, this); | 95 browser_->command_updater()->AddCommandObserver(IDC_BACK, this); |
96 browser_->command_updater()->AddCommandObserver(IDC_FORWARD, this); | 96 browser_->command_updater()->AddCommandObserver(IDC_FORWARD, this); |
97 browser_->command_updater()->AddCommandObserver(IDC_HOME, this); | 97 browser_->command_updater()->AddCommandObserver(IDC_HOME, this); |
98 browser_->command_updater()->AddCommandObserver(IDC_BOOKMARK_PAGE, this); | 98 browser_->command_updater()->AddCommandObserver(IDC_BOOKMARK_PAGE, this); |
99 | 99 |
100 registrar_.Add(this, | 100 registrar_.Add(this, |
101 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 101 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
102 NotificationService::AllSources()); | 102 NotificationService::AllSources()); |
| 103 registrar_.Add(this, |
| 104 chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED, |
| 105 Source<Profile>(browser_->profile())); |
103 } | 106 } |
104 | 107 |
105 BrowserToolbarGtk::~BrowserToolbarGtk() { | 108 BrowserToolbarGtk::~BrowserToolbarGtk() { |
106 browser_->command_updater()->RemoveCommandObserver(IDC_BACK, this); | 109 browser_->command_updater()->RemoveCommandObserver(IDC_BACK, this); |
107 browser_->command_updater()->RemoveCommandObserver(IDC_FORWARD, this); | 110 browser_->command_updater()->RemoveCommandObserver(IDC_FORWARD, this); |
108 browser_->command_updater()->RemoveCommandObserver(IDC_HOME, this); | 111 browser_->command_updater()->RemoveCommandObserver(IDC_HOME, this); |
109 browser_->command_updater()->RemoveCommandObserver(IDC_BOOKMARK_PAGE, this); | 112 browser_->command_updater()->RemoveCommandObserver(IDC_BOOKMARK_PAGE, this); |
110 | 113 |
111 offscreen_entry_.Destroy(); | 114 offscreen_entry_.Destroy(); |
112 | 115 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 376 |
374 if (use_gtk) { | 377 if (use_gtk) { |
375 // We need to manually update the icon if we are in GTK mode. (Note that | 378 // We need to manually update the icon if we are in GTK mode. (Note that |
376 // we set the initial value in Init()). | 379 // we set the initial value in Init()). |
377 gtk_image_set_from_pixbuf( | 380 gtk_image_set_from_pixbuf( |
378 GTK_IMAGE(wrench_menu_image_), | 381 GTK_IMAGE(wrench_menu_image_), |
379 theme_service_->GetRTLEnabledPixbufNamed(IDR_TOOLS)); | 382 theme_service_->GetRTLEnabledPixbufNamed(IDR_TOOLS)); |
380 } | 383 } |
381 | 384 |
382 UpdateRoundedness(); | 385 UpdateRoundedness(); |
383 } else if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { | 386 } else if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED || |
| 387 type == chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED) { |
384 // Redraw the wrench menu to update the badge. | 388 // Redraw the wrench menu to update the badge. |
385 gtk_widget_queue_draw(wrench_menu_button_->widget()); | 389 gtk_widget_queue_draw(wrench_menu_button_->widget()); |
386 } else if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { | 390 } else if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { |
387 // If our zoom level changed, we need to tell the menu to update its state, | 391 // If our zoom level changed, we need to tell the menu to update its state, |
388 // since the menu could still be open. | 392 // since the menu could still be open. |
389 wrench_menu_->UpdateMenu(); | 393 wrench_menu_->UpdateMenu(); |
390 } else { | 394 } else { |
391 NOTREACHED(); | 395 NOTREACHED(); |
392 } | 396 } |
393 } | 397 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 int x_offset = base::i18n::IsRTL() ? 0 : | 643 int x_offset = base::i18n::IsRTL() ? 0 : |
640 sender->allocation.width - badge->width(); | 644 sender->allocation.width - badge->width(); |
641 int y_offset = 0; | 645 int y_offset = 0; |
642 canvas.DrawBitmapInt( | 646 canvas.DrawBitmapInt( |
643 *badge, | 647 *badge, |
644 sender->allocation.x + x_offset, | 648 sender->allocation.x + x_offset, |
645 sender->allocation.y + y_offset); | 649 sender->allocation.y + y_offset); |
646 | 650 |
647 return FALSE; | 651 return FALSE; |
648 } | 652 } |
OLD | NEW |