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