| 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/browser_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <X11/XF86keysym.h> | 9 #include <X11/XF86keysym.h> |
| 10 | 10 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 403 } |
| 404 | 404 |
| 405 UpdateRoundedness(); | 405 UpdateRoundedness(); |
| 406 } else if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { | 406 } else if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) { |
| 407 // Redraw the wrench menu to update the badge. | 407 // Redraw the wrench menu to update the badge. |
| 408 gtk_widget_queue_draw(wrench_menu_button_->widget()); | 408 gtk_widget_queue_draw(wrench_menu_button_->widget()); |
| 409 } else if (type == chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED) { | 409 } else if (type == chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED) { |
| 410 is_wrench_menu_model_valid_ = false; | 410 is_wrench_menu_model_valid_ = false; |
| 411 gtk_widget_queue_draw(wrench_menu_button_->widget()); | 411 gtk_widget_queue_draw(wrench_menu_button_->widget()); |
| 412 } else if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { | 412 } else if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) { |
| 413 // Since BrowserToolbarGtk create a new |wrench_menu_model_| in |
| 414 // RebuildWrenchMenu(), the ordering of the observers of |
| 415 // NOTIFICATION_ZOOM_LEVEL_CHANGED can change, and result in subtle bugs |
| 416 // like http://crbug.com/118823. Rather than depending on the ordering |
| 417 // of the notification observers, always update the WrenchMenuModel before |
| 418 // updating the WrenchMenu. |
| 419 wrench_menu_model_->UpdateZoomControls(); |
| 420 |
| 413 // If our zoom level changed, we need to tell the menu to update its state, | 421 // If our zoom level changed, we need to tell the menu to update its state, |
| 414 // since the menu could still be open. | 422 // since the menu could still be open. |
| 415 wrench_menu_->UpdateMenu(); | 423 wrench_menu_->UpdateMenu(); |
| 416 } else { | 424 } else { |
| 417 NOTREACHED(); | 425 NOTREACHED(); |
| 418 } | 426 } |
| 419 } | 427 } |
| 420 | 428 |
| 421 // BrowserToolbarGtk, public --------------------------------------------------- | 429 // BrowserToolbarGtk, public --------------------------------------------------- |
| 422 | 430 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); | 698 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); |
| 691 gfx::CanvasSkiaPaint canvas(expose, false); | 699 gfx::CanvasSkiaPaint canvas(expose, false); |
| 692 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); | 700 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); |
| 693 int y_offset = 0; | 701 int y_offset = 0; |
| 694 canvas.DrawImageInt(*badge, | 702 canvas.DrawImageInt(*badge, |
| 695 allocation.x + x_offset, | 703 allocation.x + x_offset, |
| 696 allocation.y + y_offset); | 704 allocation.y + y_offset); |
| 697 | 705 |
| 698 return FALSE; | 706 return FALSE; |
| 699 } | 707 } |
| OLD | NEW |