OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_window_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <numeric> | 8 #include <numeric> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/mac/bundle_locations.h" | 12 #include "base/mac/bundle_locations.h" |
12 #import "base/mac/foundation_util.h" | 13 #import "base/mac/foundation_util.h" |
13 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
14 #import "base/mac/sdk_forward_declarations.h" | 15 #import "base/mac/sdk_forward_declarations.h" |
15 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "chrome/app/chrome_command_ids.h" // IDC_* | 18 #include "chrome/app/chrome_command_ids.h" // IDC_* |
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 ChromeTranslateClient::GetTranslateLanguages( | 1668 ChromeTranslateClient::GetTranslateLanguages( |
1668 contents, &sourceLanguage, &targetLanguage); | 1669 contents, &sourceLanguage, &targetLanguage); |
1669 | 1670 |
1670 scoped_ptr<translate::TranslateUIDelegate> uiDelegate( | 1671 scoped_ptr<translate::TranslateUIDelegate> uiDelegate( |
1671 new translate::TranslateUIDelegate( | 1672 new translate::TranslateUIDelegate( |
1672 ChromeTranslateClient::GetManagerFromWebContents(contents) | 1673 ChromeTranslateClient::GetManagerFromWebContents(contents) |
1673 ->GetWeakPtr(), | 1674 ->GetWeakPtr(), |
1674 sourceLanguage, | 1675 sourceLanguage, |
1675 targetLanguage)); | 1676 targetLanguage)); |
1676 scoped_ptr<TranslateBubbleModel> model( | 1677 scoped_ptr<TranslateBubbleModel> model( |
1677 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); | 1678 new TranslateBubbleModelImpl(step, std::move(uiDelegate))); |
1678 translateBubbleController_ = [[TranslateBubbleController alloc] | 1679 translateBubbleController_ = |
1679 initWithParentWindow:self | 1680 [[TranslateBubbleController alloc] initWithParentWindow:self |
1680 model:model.Pass() | 1681 model:std::move(model) |
1681 webContents:contents]; | 1682 webContents:contents]; |
1682 [translateBubbleController_ showWindow:nil]; | 1683 [translateBubbleController_ showWindow:nil]; |
1683 | 1684 |
1684 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1685 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
1685 [center addObserver:self | 1686 [center addObserver:self |
1686 selector:@selector(translateBubbleWindowWillClose:) | 1687 selector:@selector(translateBubbleWindowWillClose:) |
1687 name:NSWindowWillCloseNotification | 1688 name:NSWindowWillCloseNotification |
1688 object:[translateBubbleController_ window]]; | 1689 object:[translateBubbleController_ window]]; |
1689 } | 1690 } |
1690 | 1691 |
1691 - (void)dismissPermissionBubble { | 1692 - (void)dismissPermissionBubble { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2108 | 2109 |
2109 - (BOOL)supportsBookmarkBar { | 2110 - (BOOL)supportsBookmarkBar { |
2110 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2111 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2111 } | 2112 } |
2112 | 2113 |
2113 - (BOOL)isTabbedWindow { | 2114 - (BOOL)isTabbedWindow { |
2114 return browser_->is_type_tabbed(); | 2115 return browser_->is_type_tabbed(); |
2115 } | 2116 } |
2116 | 2117 |
2117 @end // @implementation BrowserWindowController(WindowType) | 2118 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |