| 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/extensions/extension_installed_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 if (extension == extension_) | 121 if (extension == extension_) |
| 122 extension_ = NULL; | 122 extension_ = NULL; |
| 123 } else { | 123 } else { |
| 124 NOTREACHED() << L"Received unexpected notification"; | 124 NOTREACHED() << L"Received unexpected notification"; |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 | 127 |
| 128 void ExtensionInstalledBubbleGtk::ShowInternal() { | 128 void ExtensionInstalledBubbleGtk::ShowInternal() { |
| 129 BrowserWindowGtk* browser_window = | 129 BrowserWindowGtk* browser_window = |
| 130 BrowserWindowGtk::GetBrowserWindowForNativeWindow( | 130 BrowserWindowGtk::GetBrowserWindowForNativeWindow( |
| 131 browser_->window()->GetNativeHandle()); | 131 browser_->window()->GetNativeWindow()); |
| 132 | 132 |
| 133 GtkWidget* reference_widget = NULL; | 133 GtkWidget* reference_widget = NULL; |
| 134 | 134 |
| 135 if (type_ == BROWSER_ACTION) { | 135 if (type_ == BROWSER_ACTION) { |
| 136 BrowserActionsToolbarGtk* toolbar = | 136 BrowserActionsToolbarGtk* toolbar = |
| 137 browser_window->GetToolbar()->GetBrowserActionsToolbar(); | 137 browser_window->GetToolbar()->GetBrowserActionsToolbar(); |
| 138 | 138 |
| 139 if (toolbar->animating() && animation_wait_retries_-- > 0) { | 139 if (toolbar->animating() && animation_wait_retries_-- > 0) { |
| 140 MessageLoopForUI::current()->PostDelayedTask( | 140 MessageLoopForUI::current()->PostDelayedTask( |
| 141 FROM_HERE, | 141 FROM_HERE, |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } else { | 338 } else { |
| 339 NOTREACHED(); | 339 NOTREACHED(); |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 void ExtensionInstalledBubbleGtk::BubbleClosing(BubbleGtk* bubble, | 342 void ExtensionInstalledBubbleGtk::BubbleClosing(BubbleGtk* bubble, |
| 343 bool closed_by_escape) { | 343 bool closed_by_escape) { |
| 344 if (extension_ && type_ == PAGE_ACTION) { | 344 if (extension_ && type_ == PAGE_ACTION) { |
| 345 // Turn the page action preview off. | 345 // Turn the page action preview off. |
| 346 BrowserWindowGtk* browser_window = | 346 BrowserWindowGtk* browser_window = |
| 347 BrowserWindowGtk::GetBrowserWindowForNativeWindow( | 347 BrowserWindowGtk::GetBrowserWindowForNativeWindow( |
| 348 browser_->window()->GetNativeHandle()); | 348 browser_->window()->GetNativeWindow()); |
| 349 LocationBarViewGtk* location_bar_view = | 349 LocationBarViewGtk* location_bar_view = |
| 350 browser_window->GetToolbar()->GetLocationBarView(); | 350 browser_window->GetToolbar()->GetLocationBarView(); |
| 351 location_bar_view->SetPreviewEnabledPageAction(extension_->page_action(), | 351 location_bar_view->SetPreviewEnabledPageAction(extension_->page_action(), |
| 352 false); // preview_enabled | 352 false); // preview_enabled |
| 353 } | 353 } |
| 354 | 354 |
| 355 // We need to allow the bubble to close and remove the widgets from | 355 // We need to allow the bubble to close and remove the widgets from |
| 356 // the window before we call Release() because close_button_ depends | 356 // the window before we call Release() because close_button_ depends |
| 357 // on all references being cleared before it is destroyed. | 357 // on all references being cleared before it is destroyed. |
| 358 MessageLoopForUI::current()->PostTask( | 358 MessageLoopForUI::current()->PostTask( |
| 359 FROM_HERE, | 359 FROM_HERE, |
| 360 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); | 360 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void ExtensionInstalledBubbleGtk::Close() { | 363 void ExtensionInstalledBubbleGtk::Close() { |
| 364 Release(); // Balanced in ctor. | 364 Release(); // Balanced in ctor. |
| 365 bubble_ = NULL; | 365 bubble_ = NULL; |
| 366 } | 366 } |
| OLD | NEW |