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 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 const BookmarkNode* node = [sender node]; | 1746 const BookmarkNode* node = [sender node]; |
1747 if (node) | 1747 if (node) |
1748 BookmarkEditor::Show([self window], browser_->profile(), | 1748 BookmarkEditor::Show([self window], browser_->profile(), |
1749 BookmarkEditor::EditDetails::EditNode(node), | 1749 BookmarkEditor::EditDetails::EditNode(node), |
1750 BookmarkEditor::SHOW_TREE); | 1750 BookmarkEditor::SHOW_TREE); |
1751 } | 1751 } |
1752 } | 1752 } |
1753 | 1753 |
1754 - (void)showTranslateBubbleForWebContents:(content::WebContents*)contents | 1754 - (void)showTranslateBubbleForWebContents:(content::WebContents*)contents |
1755 step:(translate::TranslateStep)step | 1755 step:(translate::TranslateStep)step |
1756 errorType:(TranslateErrors::Type)errorType { | 1756 errorType:(translate::TranslateErrors::Type) |
| 1757 errorType { |
1757 // TODO(hajimehoshi): The similar logic exists at TranslateBubbleView:: | 1758 // TODO(hajimehoshi): The similar logic exists at TranslateBubbleView:: |
1758 // ShowBubble. This should be unified. | 1759 // ShowBubble. This should be unified. |
1759 if (translateBubbleController_) { | 1760 if (translateBubbleController_) { |
1760 // When the user reads the advanced setting panel, the bubble should not be | 1761 // When the user reads the advanced setting panel, the bubble should not be |
1761 // changed because he/she is focusing on the bubble. | 1762 // changed because he/she is focusing on the bubble. |
1762 if (translateBubbleController_.webContents == contents && | 1763 if (translateBubbleController_.webContents == contents && |
1763 translateBubbleController_.model->GetViewState() == | 1764 translateBubbleController_.model->GetViewState() == |
1764 TranslateBubbleModel::VIEW_STATE_ADVANCED) { | 1765 TranslateBubbleModel::VIEW_STATE_ADVANCED) { |
1765 return; | 1766 return; |
1766 } | 1767 } |
1767 if (step != translate::TRANSLATE_STEP_TRANSLATE_ERROR) { | 1768 if (step != translate::TRANSLATE_STEP_TRANSLATE_ERROR) { |
1768 TranslateBubbleModel::ViewState viewState = | 1769 TranslateBubbleModel::ViewState viewState = |
1769 TranslateBubbleModelImpl::TranslateStepToViewState(step); | 1770 TranslateBubbleModelImpl::TranslateStepToViewState(step); |
1770 [translateBubbleController_ switchView:viewState]; | 1771 [translateBubbleController_ switchView:viewState]; |
1771 } else { | 1772 } else { |
1772 [translateBubbleController_ switchToErrorView:errorType]; | 1773 [translateBubbleController_ switchToErrorView:errorType]; |
1773 } | 1774 } |
1774 return; | 1775 return; |
1775 } | 1776 } |
1776 | 1777 |
1777 std::string sourceLanguage; | 1778 std::string sourceLanguage; |
1778 std::string targetLanguage; | 1779 std::string targetLanguage; |
1779 ChromeTranslateClient::GetTranslateLanguages( | 1780 ChromeTranslateClient::GetTranslateLanguages( |
1780 contents, &sourceLanguage, &targetLanguage); | 1781 contents, &sourceLanguage, &targetLanguage); |
1781 | 1782 |
1782 scoped_ptr<TranslateUIDelegate> uiDelegate(new TranslateUIDelegate( | 1783 scoped_ptr<translate::TranslateUIDelegate> uiDelegate( |
1783 ChromeTranslateClient::GetManagerFromWebContents(contents)->GetWeakPtr(), | 1784 new translate::TranslateUIDelegate( |
1784 sourceLanguage, | 1785 ChromeTranslateClient::GetManagerFromWebContents(contents) |
1785 targetLanguage)); | 1786 ->GetWeakPtr(), |
| 1787 sourceLanguage, |
| 1788 targetLanguage)); |
1786 scoped_ptr<TranslateBubbleModel> model( | 1789 scoped_ptr<TranslateBubbleModel> model( |
1787 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); | 1790 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); |
1788 translateBubbleController_ = [[TranslateBubbleController alloc] | 1791 translateBubbleController_ = [[TranslateBubbleController alloc] |
1789 initWithParentWindow:self | 1792 initWithParentWindow:self |
1790 model:model.Pass() | 1793 model:model.Pass() |
1791 webContents:contents]; | 1794 webContents:contents]; |
1792 [translateBubbleController_ showWindow:nil]; | 1795 [translateBubbleController_ showWindow:nil]; |
1793 | 1796 |
1794 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 1797 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
1795 [center addObserver:self | 1798 [center addObserver:self |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2293 | 2296 |
2294 - (BOOL)supportsBookmarkBar { | 2297 - (BOOL)supportsBookmarkBar { |
2295 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2298 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
2296 } | 2299 } |
2297 | 2300 |
2298 - (BOOL)isTabbedWindow { | 2301 - (BOOL)isTabbedWindow { |
2299 return browser_->is_type_tabbed(); | 2302 return browser_->is_type_tabbed(); |
2300 } | 2303 } |
2301 | 2304 |
2302 @end // @implementation BrowserWindowController(WindowType) | 2305 @end // @implementation BrowserWindowController(WindowType) |
OLD | NEW |