Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/toolbar/browser_action_view.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 notification_source); | 72 notification_source); |
| 73 | 73 |
| 74 // We also listen for browser theme changes on linux because a switch from or | 74 // We also listen for browser theme changes on linux because a switch from or |
| 75 // to GTK requires that we regrab our browser action images. | 75 // to GTK requires that we regrab our browser action images. |
| 76 registrar_.Add( | 76 registrar_.Add( |
| 77 this, | 77 this, |
| 78 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 78 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 79 content::Source<ThemeService>( | 79 content::Source<ThemeService>( |
| 80 ThemeServiceFactory::GetForProfile(browser->profile()))); | 80 ThemeServiceFactory::GetForProfile(browser->profile()))); |
| 81 | 81 |
| 82 Layout(); // We need to layout since we may have added an icon as a result. | |
|
Peter Kasting
2014/09/26 20:28:17
Should Layout() call UpdateState()? Conversely, s
Devlin
2014/09/26 20:45:34
Sorry about that - copied the patch over from a Wi
| |
| 82 UpdateState(); | 83 UpdateState(); |
| 83 } | 84 } |
| 84 | 85 |
| 85 BrowserActionView::~BrowserActionView() { | 86 BrowserActionView::~BrowserActionView() { |
| 86 } | 87 } |
| 87 | 88 |
| 88 void BrowserActionView::ViewHierarchyChanged( | 89 void BrowserActionView::ViewHierarchyChanged( |
| 89 const ViewHierarchyChangedDetails& details) { | 90 const ViewHierarchyChangedDetails& details) { |
| 90 if (details.is_add && !called_registered_extension_command_ && | 91 if (details.is_add && !called_registered_extension_command_ && |
| 91 GetFocusManager()) { | 92 GetFocusManager()) { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 } | 337 } |
| 337 | 338 |
| 338 void BrowserActionView::CleanupPopup() { | 339 void BrowserActionView::CleanupPopup() { |
| 339 // We need to do these actions synchronously (instead of closing and then | 340 // We need to do these actions synchronously (instead of closing and then |
| 340 // performing the rest of the cleanup in OnWidgetDestroyed()) because | 341 // performing the rest of the cleanup in OnWidgetDestroyed()) because |
| 341 // OnWidgetDestroyed() can be called asynchronously from Close(), and we need | 342 // OnWidgetDestroyed() can be called asynchronously from Close(), and we need |
| 342 // to keep the delegate's popup owner up-to-date. | 343 // to keep the delegate's popup owner up-to-date. |
| 343 delegate_->SetPopupOwner(NULL); | 344 delegate_->SetPopupOwner(NULL); |
| 344 pressed_lock_.reset(); // Unpress the menu button if it was pressed. | 345 pressed_lock_.reset(); // Unpress the menu button if it was pressed. |
| 345 } | 346 } |
| OLD | NEW |