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/views/extensions/extension_installed_bubble.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
35 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
36 #include "ui/views/controls/button/image_button.h" | 36 #include "ui/views/controls/button/image_button.h" |
37 #include "ui/views/controls/image_view.h" | 37 #include "ui/views/controls/image_view.h" |
38 #include "ui/views/controls/label.h" | 38 #include "ui/views/controls/label.h" |
39 #include "ui/views/controls/link.h" | 39 #include "ui/views/controls/link.h" |
40 #include "ui/views/controls/link_listener.h" | 40 #include "ui/views/controls/link_listener.h" |
41 #include "ui/views/layout/fill_layout.h" | 41 #include "ui/views/layout/fill_layout.h" |
42 #include "ui/views/layout/layout_constants.h" | 42 #include "ui/views/layout/layout_constants.h" |
43 | 43 |
| 44 using extensions::Extension; |
| 45 |
44 namespace { | 46 namespace { |
45 | 47 |
46 const int kIconSize = 43; | 48 const int kIconSize = 43; |
47 | 49 |
48 const int kRightColumnWidth = 285; | 50 const int kRightColumnWidth = 285; |
49 | 51 |
50 // The Bubble uses a BubbleBorder which adds about 6 pixels of whitespace | 52 // The Bubble uses a BubbleBorder which adds about 6 pixels of whitespace |
51 // around the content view. We compensate by reducing our outer borders by this | 53 // around the content view. We compensate by reducing our outer borders by this |
52 // amount + 4px. | 54 // amount + 4px. |
53 const int kOuterMarginInset = 10; | 55 const int kOuterMarginInset = 10; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 if (extension == extension_) { | 382 if (extension == extension_) { |
381 animation_wait_retries_ = 0; | 383 animation_wait_retries_ = 0; |
382 // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. | 384 // PostTask to ourself to allow all EXTENSION_LOADED Observers to run. |
383 MessageLoopForUI::current()->PostTask( | 385 MessageLoopForUI::current()->PostTask( |
384 FROM_HERE, | 386 FROM_HERE, |
385 base::Bind(&ExtensionInstalledBubble::ShowInternal, | 387 base::Bind(&ExtensionInstalledBubble::ShowInternal, |
386 base::Unretained(this))); | 388 base::Unretained(this))); |
387 } | 389 } |
388 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 390 } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { |
389 const Extension* extension = | 391 const Extension* extension = |
390 content::Details<UnloadedExtensionInfo>(details)->extension; | 392 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; |
391 if (extension == extension_) | 393 if (extension == extension_) |
392 extension_ = NULL; | 394 extension_ = NULL; |
393 } else { | 395 } else { |
394 NOTREACHED() << L"Received unexpected notification"; | 396 NOTREACHED() << L"Received unexpected notification"; |
395 } | 397 } |
396 } | 398 } |
397 | 399 |
398 void ExtensionInstalledBubble::ShowInternal() { | 400 void ExtensionInstalledBubble::ShowInternal() { |
399 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 401 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
400 | 402 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } | 476 } |
475 | 477 |
476 void ExtensionInstalledBubble::WindowClosing() { | 478 void ExtensionInstalledBubble::WindowClosing() { |
477 if (extension_ && type_ == PAGE_ACTION) { | 479 if (extension_ && type_ == PAGE_ACTION) { |
478 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 480 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
479 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 481 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
480 extension_->page_action(), | 482 extension_->page_action(), |
481 false); // preview_enabled | 483 false); // preview_enabled |
482 } | 484 } |
483 } | 485 } |
OLD | NEW |