| 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_tab_helper.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 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 if (step != TranslateTabHelper::TRANSLATE_ERROR) { | 1768 if (step != TranslateTabHelper::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 // TODO(hajimehoshi): Set the initial languages correctly. | 1778 std::string sourceLanguage; |
| 1778 std::string sourceLanguage = "xx"; | 1779 std::string targetLanguage; |
| 1779 std::string targetLanguage = "yy"; | 1780 TranslateTabHelper::GetTranslateLanguages(contents, |
| 1781 &sourceLanguage, &targetLanguage); |
| 1780 | 1782 |
| 1781 scoped_ptr<TranslateUIDelegate> uiDelegate( | 1783 scoped_ptr<TranslateUIDelegate> uiDelegate( |
| 1782 new TranslateUIDelegate(contents, sourceLanguage, targetLanguage)); | 1784 new TranslateUIDelegate(contents, sourceLanguage, targetLanguage)); |
| 1783 scoped_ptr<TranslateBubbleModel> model( | 1785 scoped_ptr<TranslateBubbleModel> model( |
| 1784 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); | 1786 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); |
| 1785 translateBubbleController_ = [[TranslateBubbleController alloc] | 1787 translateBubbleController_ = [[TranslateBubbleController alloc] |
| 1786 initWithParentWindow:self | 1788 initWithParentWindow:self |
| 1787 model:model.Pass() | 1789 model:model.Pass() |
| 1788 webContents:contents]; | 1790 webContents:contents]; |
| 1789 [translateBubbleController_ showWindow:nil]; | 1791 [translateBubbleController_ showWindow:nil]; |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 | 2315 |
| 2314 - (BOOL)supportsBookmarkBar { | 2316 - (BOOL)supportsBookmarkBar { |
| 2315 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; | 2317 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; |
| 2316 } | 2318 } |
| 2317 | 2319 |
| 2318 - (BOOL)isTabbedWindow { | 2320 - (BOOL)isTabbedWindow { |
| 2319 return browser_->is_type_tabbed(); | 2321 return browser_->is_type_tabbed(); |
| 2320 } | 2322 } |
| 2321 | 2323 |
| 2322 @end // @implementation BrowserWindowController(WindowType) | 2324 @end // @implementation BrowserWindowController(WindowType) |
| OLD | NEW |