| 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 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle
r.h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle
r.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> |
| 10 |
| 9 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/extensions/bundle_installer.h" | 16 #include "chrome/browser/extensions/bundle_installer.h" |
| 15 #include "chrome/browser/extensions/extension_action.h" | 17 #include "chrome/browser/extensions/extension_action.h" |
| 16 #include "chrome/browser/extensions/extension_action_manager.h" | 18 #include "chrome/browser/extensions/extension_action_manager.h" |
| 17 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_navigator.h" | 20 #include "chrome/browser/ui/browser_navigator.h" |
| 19 #include "chrome/browser/ui/browser_navigator_params.h" | 21 #include "chrome/browser/ui/browser_navigator_params.h" |
| 20 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
| 21 #include "chrome/browser/ui/chrome_pages.h" | 23 #include "chrome/browser/ui/chrome_pages.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 117 } |
| 116 | 118 |
| 117 } // namespace | 119 } // namespace |
| 118 | 120 |
| 119 // Cocoa specific implementation. | 121 // Cocoa specific implementation. |
| 120 bool ExtensionInstalledBubble::ShouldShow() { | 122 bool ExtensionInstalledBubble::ShouldShow() { |
| 121 return true; | 123 return true; |
| 122 } | 124 } |
| 123 | 125 |
| 124 // Implemented here to create the platform specific instance of the BubbleUi. | 126 // Implemented here to create the platform specific instance of the BubbleUi. |
| 125 scoped_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { | 127 std::unique_ptr<BubbleUi> ExtensionInstalledBubble::BuildBubbleUi() { |
| 126 // |controller| is owned by the parent window. | 128 // |controller| is owned by the parent window. |
| 127 ExtensionInstalledBubbleController* controller = | 129 ExtensionInstalledBubbleController* controller = |
| 128 [[ExtensionInstalledBubbleController alloc] | 130 [[ExtensionInstalledBubbleController alloc] |
| 129 initWithParentWindow:browser()->window()->GetNativeWindow() | 131 initWithParentWindow:browser()->window()->GetNativeWindow() |
| 130 extensionBubble:this]; | 132 extensionBubble:this]; |
| 131 | 133 |
| 132 // The bridge to the C++ object that performs shared logic across platforms. | 134 // The bridge to the C++ object that performs shared logic across platforms. |
| 133 // This tells the controller when to show the bubble. | 135 // This tells the controller when to show the bubble. |
| 134 return make_scoped_ptr(new ExtensionInstalledBubbleBridge(controller)); | 136 return base::WrapUnique(new ExtensionInstalledBubbleBridge(controller)); |
| 135 } | 137 } |
| 136 | 138 |
| 137 @implementation ExtensionInstalledBubbleController | 139 @implementation ExtensionInstalledBubbleController |
| 138 | 140 |
| 139 @synthesize bundle = bundle_; | 141 @synthesize bundle = bundle_; |
| 140 @synthesize installedBubble = installedBubble_; | 142 @synthesize installedBubble = installedBubble_; |
| 141 // Exposed for unit tests. | 143 // Exposed for unit tests. |
| 142 @synthesize heading = heading_; | 144 @synthesize heading = heading_; |
| 143 @synthesize closeButton = closeButton_; | 145 @synthesize closeButton = closeButton_; |
| 144 @synthesize howToUse = howToUse_; | 146 @synthesize howToUse = howToUse_; |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 bool didClose = [self bubbleReference]->CloseBubble(BUBBLE_CLOSE_ACCEPTED); | 600 bool didClose = [self bubbleReference]->CloseBubble(BUBBLE_CLOSE_ACCEPTED); |
| 599 DCHECK(didClose); | 601 DCHECK(didClose); |
| 600 std::string configure_url = chrome::kChromeUIExtensionsURL; | 602 std::string configure_url = chrome::kChromeUIExtensionsURL; |
| 601 configure_url += chrome::kExtensionConfigureCommandsSubPage; | 603 configure_url += chrome::kExtensionConfigureCommandsSubPage; |
| 602 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 604 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| 603 browser_, GURL(configure_url))); | 605 browser_, GURL(configure_url))); |
| 604 chrome::Navigate(¶ms); | 606 chrome::Navigate(¶ms); |
| 605 } | 607 } |
| 606 | 608 |
| 607 - (IBAction)onAppShortcutClicked:(id)sender { | 609 - (IBAction)onAppShortcutClicked:(id)sender { |
| 608 scoped_ptr<extensions::ExtensionInstallUI> install_ui( | 610 std::unique_ptr<extensions::ExtensionInstallUI> install_ui( |
| 609 extensions::CreateExtensionInstallUI(browser_->profile())); | 611 extensions::CreateExtensionInstallUI(browser_->profile())); |
| 610 install_ui->OpenAppInstalledUI([self extension]->id()); | 612 install_ui->OpenAppInstalledUI([self extension]->id()); |
| 611 } | 613 } |
| 612 | 614 |
| 613 - (void)doClose { | 615 - (void)doClose { |
| 614 installedBubble_ = nullptr; | 616 installedBubble_ = nullptr; |
| 615 [self close]; | 617 [self close]; |
| 616 } | 618 } |
| 617 | 619 |
| 618 @end | 620 @end |
| OLD | NEW |