| 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" |
| 11 #include "base/mac/bundle_locations.h" | 11 #include "base/mac/bundle_locations.h" |
| 12 #import "base/mac/foundation_util.h" | 12 #import "base/mac/foundation_util.h" |
| 13 #include "base/mac/mac_util.h" | 13 #include "base/mac/mac_util.h" |
| 14 #import "base/mac/sdk_forward_declarations.h" | 14 #import "base/mac/sdk_forward_declarations.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/app/chrome_command_ids.h" // IDC_* | 17 #include "chrome/app/chrome_command_ids.h" // IDC_* |
| 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/devtools/devtools_window.h" | 20 #include "chrome/browser/devtools/devtools_window.h" |
| 21 #include "chrome/browser/fullscreen.h" | 21 #include "chrome/browser/fullscreen.h" |
| 22 #include "chrome/browser/profiles/avatar_menu.h" | 22 #include "chrome/browser/profiles/avatar_menu.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/profiles/profile_info_cache.h" | 24 #include "chrome/browser/profiles/profile_info_cache.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/profiles/profiles_state.h" | 26 #include "chrome/browser/profiles/profiles_state.h" |
| 27 #include "chrome/browser/signin/signin_ui_util.h" | 27 #include "chrome/browser/signin/signin_ui_util.h" |
| 28 #include "chrome/browser/themes/theme_service.h" | 28 #include "chrome/browser/themes/theme_service.h" |
| 29 #include "chrome/browser/themes/theme_service_factory.h" | 29 #include "chrome/browser/themes/theme_service_factory.h" |
| 30 #include "chrome/browser/translate/translate_manager.h" |
| 30 #include "chrome/browser/translate/translate_ui_delegate.h" | 31 #include "chrome/browser/translate/translate_ui_delegate.h" |
| 31 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" | 32 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
| 32 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 33 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 33 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
| 34 #include "chrome/browser/ui/browser_command_controller.h" | 35 #include "chrome/browser/ui/browser_command_controller.h" |
| 35 #include "chrome/browser/ui/browser_commands.h" | 36 #include "chrome/browser/ui/browser_commands.h" |
| 36 #include "chrome/browser/ui/browser_instant_controller.h" | 37 #include "chrome/browser/ui/browser_instant_controller.h" |
| 37 #include "chrome/browser/ui/browser_list.h" | 38 #include "chrome/browser/ui/browser_list.h" |
| 38 #include "chrome/browser/ui/browser_window_state.h" | 39 #include "chrome/browser/ui/browser_window_state.h" |
| 39 #import "chrome/browser/ui/cocoa/background_gradient_view.h" | 40 #import "chrome/browser/ui/cocoa/background_gradient_view.h" |
| (...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 if (step != TranslateTabHelper::TRANSLATE_ERROR) { | 1780 if (step != TranslateTabHelper::TRANSLATE_ERROR) { |
| 1780 TranslateBubbleModel::ViewState viewState = | 1781 TranslateBubbleModel::ViewState viewState = |
| 1781 TranslateBubbleModelImpl::TranslateStepToViewState(step); | 1782 TranslateBubbleModelImpl::TranslateStepToViewState(step); |
| 1782 [translateBubbleController_ switchView:viewState]; | 1783 [translateBubbleController_ switchView:viewState]; |
| 1783 } else { | 1784 } else { |
| 1784 [translateBubbleController_ switchToErrorView:errorType]; | 1785 [translateBubbleController_ switchToErrorView:errorType]; |
| 1785 } | 1786 } |
| 1786 return; | 1787 return; |
| 1787 } | 1788 } |
| 1788 | 1789 |
| 1789 // TODO(hajimehoshi): Set the initial languages correctly. | 1790 std::string sourceLanguage; |
| 1790 std::string sourceLanguage = "xx"; | 1791 std::string targetLanguage; |
| 1791 std::string targetLanguage = "yy"; | 1792 TranslateManager::GetTranslateLanguages(contents, |
| 1793 &sourceLanguage, &targetLanguage); |
| 1792 | 1794 |
| 1793 scoped_ptr<TranslateUIDelegate> uiDelegate( | 1795 scoped_ptr<TranslateUIDelegate> uiDelegate( |
| 1794 new TranslateUIDelegate(contents, sourceLanguage, targetLanguage)); | 1796 new TranslateUIDelegate(contents, sourceLanguage, targetLanguage)); |
| 1795 scoped_ptr<TranslateBubbleModel> model( | 1797 scoped_ptr<TranslateBubbleModel> model( |
| 1796 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); | 1798 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); |
| 1797 translateBubbleController_ = [[TranslateBubbleController alloc] | 1799 translateBubbleController_ = [[TranslateBubbleController alloc] |
| 1798 initWithParentWindow:self | 1800 initWithParentWindow:self |
| 1799 model:model.Pass() | 1801 model:model.Pass() |
| 1800 webContents:contents]; | 1802 webContents:contents]; |
| 1801 [translateBubbleController_ showWindow:nil]; | 1803 [translateBubbleController_ showWindow:nil]; |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2325 | 2327 |
| 2326 - (BOOL)supportsBookmarkBar { | 2328 - (BOOL)supportsBookmarkBar { |
| 2327 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2329 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2328 } | 2330 } |
| 2329 | 2331 |
| 2330 - (BOOL)isTabbedWindow { | 2332 - (BOOL)isTabbedWindow { |
| 2331 return browser_->is_type_tabbed(); | 2333 return browser_->is_type_tabbed(); |
| 2332 } | 2334 } |
| 2333 | 2335 |
| 2334 @end // @implementation BrowserWindowController(WindowType) | 2336 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |