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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 void ExtensionInstalledBubbleGtk::Observe( | 112 void ExtensionInstalledBubbleGtk::Observe( |
113 int type, | 113 int type, |
114 const content::NotificationSource& source, | 114 const content::NotificationSource& source, |
115 const content::NotificationDetails& details) { | 115 const content::NotificationDetails& details) { |
116 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { | 116 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { |
117 const Extension* extension = | 117 const Extension* extension = |
118 content::Details<const Extension>(details).ptr(); | 118 content::Details<const Extension>(details).ptr(); |
119 if (extension == extension_) { | 119 if (extension == extension_) { |
120 // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. | 120 // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. |
121 MessageLoopForUI::current()->PostTask( | 121 base::MessageLoopForUI::current()->PostTask( |
122 FROM_HERE, | 122 FROM_HERE, |
123 base::Bind(&ExtensionInstalledBubbleGtk::ShowInternal, | 123 base::Bind(&ExtensionInstalledBubbleGtk::ShowInternal, |
124 weak_factory_.GetWeakPtr())); | 124 weak_factory_.GetWeakPtr())); |
125 } | 125 } |
126 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 126 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
127 const Extension* extension = | 127 const Extension* extension = |
128 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; | 128 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; |
129 if (extension == extension_) | 129 if (extension == extension_) |
130 extension_ = NULL; | 130 extension_ = NULL; |
131 } else if (type == chrome::NOTIFICATION_BROWSER_CLOSING) { | 131 } else if (type == chrome::NOTIFICATION_BROWSER_CLOSING) { |
(...skipping 15 matching lines...) Expand all Loading... |
147 BrowserWindowGtk::GetBrowserWindowForNativeWindow( | 147 BrowserWindowGtk::GetBrowserWindowForNativeWindow( |
148 browser_->window()->GetNativeWindow()); | 148 browser_->window()->GetNativeWindow()); |
149 | 149 |
150 GtkWidget* reference_widget = NULL; | 150 GtkWidget* reference_widget = NULL; |
151 | 151 |
152 if (type_ == BROWSER_ACTION) { | 152 if (type_ == BROWSER_ACTION) { |
153 BrowserActionsToolbarGtk* toolbar = | 153 BrowserActionsToolbarGtk* toolbar = |
154 browser_window->GetToolbar()->GetBrowserActionsToolbar(); | 154 browser_window->GetToolbar()->GetBrowserActionsToolbar(); |
155 | 155 |
156 if (toolbar->animating() && animation_wait_retries_-- > 0) { | 156 if (toolbar->animating() && animation_wait_retries_-- > 0) { |
157 MessageLoopForUI::current()->PostDelayedTask( | 157 base::MessageLoopForUI::current()->PostDelayedTask( |
158 FROM_HERE, | 158 FROM_HERE, |
159 base::Bind(&ExtensionInstalledBubbleGtk::ShowInternal, | 159 base::Bind(&ExtensionInstalledBubbleGtk::ShowInternal, |
160 weak_factory_.GetWeakPtr()), | 160 weak_factory_.GetWeakPtr()), |
161 base::TimeDelta::FromMilliseconds(kAnimationWaitMS)); | 161 base::TimeDelta::FromMilliseconds(kAnimationWaitMS)); |
162 return; | 162 return; |
163 } | 163 } |
164 | 164 |
165 reference_widget = toolbar->GetBrowserActionWidget(extension_); | 165 reference_widget = toolbar->GetBrowserActionWidget(extension_); |
166 // glib delays recalculating layout, but we need reference_widget to know | 166 // glib delays recalculating layout, but we need reference_widget to know |
167 // its coordinates, so we force a check_resize here. | 167 // its coordinates, so we force a check_resize here. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 BrowserWindowGtk::GetBrowserWindowForNativeWindow( | 393 BrowserWindowGtk::GetBrowserWindowForNativeWindow( |
394 browser_->window()->GetNativeWindow()); | 394 browser_->window()->GetNativeWindow()); |
395 LocationBarViewGtk* location_bar_view = | 395 LocationBarViewGtk* location_bar_view = |
396 browser_window->GetToolbar()->GetLocationBarView(); | 396 browser_window->GetToolbar()->GetLocationBarView(); |
397 location_bar_view->SetPreviewEnabledPageAction( | 397 location_bar_view->SetPreviewEnabledPageAction( |
398 ExtensionActionManager::Get(browser_->profile())-> | 398 ExtensionActionManager::Get(browser_->profile())-> |
399 GetPageAction(*extension_), | 399 GetPageAction(*extension_), |
400 false); // preview_enabled | 400 false); // preview_enabled |
401 } | 401 } |
402 } | 402 } |
OLD | NEW |