Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(703)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 229363002: Componentize TranslateUIDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10 matching lines...) Expand all
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_tab_helper.h"
31 #include "chrome/browser/translate/translate_ui_delegate.h"
32 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" 31 #include "chrome/browser/ui/bookmarks/bookmark_editor.h"
33 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 32 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
34 #include "chrome/browser/ui/browser.h" 33 #include "chrome/browser/ui/browser.h"
35 #include "chrome/browser/ui/browser_command_controller.h" 34 #include "chrome/browser/ui/browser_command_controller.h"
36 #include "chrome/browser/ui/browser_commands.h" 35 #include "chrome/browser/ui/browser_commands.h"
37 #include "chrome/browser/ui/browser_instant_controller.h" 36 #include "chrome/browser/ui/browser_instant_controller.h"
38 #include "chrome/browser/ui/browser_list.h" 37 #include "chrome/browser/ui/browser_list.h"
39 #include "chrome/browser/ui/browser_window_state.h" 38 #include "chrome/browser/ui/browser_window_state.h"
40 #import "chrome/browser/ui/cocoa/background_gradient_view.h" 39 #import "chrome/browser/ui/cocoa/background_gradient_view.h"
41 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" 40 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "chrome/browser/ui/tabs/tab_strip_model.h" 72 #include "chrome/browser/ui/tabs/tab_strip_model.h"
74 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" 73 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
75 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 74 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
76 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" 75 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h"
77 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 76 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
78 #include "chrome/browser/ui/window_sizer/window_sizer.h" 77 #include "chrome/browser/ui/window_sizer/window_sizer.h"
79 #include "chrome/common/chrome_switches.h" 78 #include "chrome/common/chrome_switches.h"
80 #include "chrome/common/extensions/command.h" 79 #include "chrome/common/extensions/command.h"
81 #include "chrome/common/profile_management_switches.h" 80 #include "chrome/common/profile_management_switches.h"
82 #include "chrome/common/url_constants.h" 81 #include "chrome/common/url_constants.h"
82 #include "components/translate/core/browser/translate_ui_delegate.h"
83 #include "components/web_modal/web_contents_modal_dialog_manager.h" 83 #include "components/web_modal/web_contents_modal_dialog_manager.h"
84 #include "content/public/browser/render_view_host.h" 84 #include "content/public/browser/render_view_host.h"
85 #include "content/public/browser/render_widget_host_view.h" 85 #include "content/public/browser/render_widget_host_view.h"
86 #include "content/public/browser/web_contents.h" 86 #include "content/public/browser/web_contents.h"
87 #include "content/public/browser/web_contents_view.h" 87 #include "content/public/browser/web_contents_view.h"
88 #include "grit/chromium_strings.h" 88 #include "grit/chromium_strings.h"
89 #include "grit/generated_resources.h" 89 #include "grit/generated_resources.h"
90 #include "grit/locale_settings.h" 90 #include "grit/locale_settings.h"
91 #import "ui/base/cocoa/cocoa_base_utils.h" 91 #import "ui/base/cocoa/cocoa_base_utils.h"
92 #include "ui/base/l10n/l10n_util.h" 92 #include "ui/base/l10n/l10n_util.h"
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 [translateBubbleController_ switchToErrorView:errorType]; 1783 [translateBubbleController_ switchToErrorView:errorType];
1784 } 1784 }
1785 return; 1785 return;
1786 } 1786 }
1787 1787
1788 std::string sourceLanguage; 1788 std::string sourceLanguage;
1789 std::string targetLanguage; 1789 std::string targetLanguage;
1790 TranslateTabHelper::GetTranslateLanguages(contents, 1790 TranslateTabHelper::GetTranslateLanguages(contents,
1791 &sourceLanguage, &targetLanguage); 1791 &sourceLanguage, &targetLanguage);
1792 1792
1793 scoped_ptr<TranslateUIDelegate> uiDelegate( 1793 scoped_ptr<TranslateUIDelegate> uiDelegate(new TranslateUIDelegate(
1794 new TranslateUIDelegate(contents, sourceLanguage, targetLanguage)); 1794 TranslateTabHelper::FromWebContents(contents),
1795 TranslateTabHelper::GetManagerFromWebContents(contents),
1796 sourceLanguage,
1797 targetLanguage));
1795 scoped_ptr<TranslateBubbleModel> model( 1798 scoped_ptr<TranslateBubbleModel> model(
1796 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); 1799 new TranslateBubbleModelImpl(step, uiDelegate.Pass()));
1797 translateBubbleController_ = [[TranslateBubbleController alloc] 1800 translateBubbleController_ = [[TranslateBubbleController alloc]
1798 initWithParentWindow:self 1801 initWithParentWindow:self
1799 model:model.Pass() 1802 model:model.Pass()
1800 webContents:contents]; 1803 webContents:contents];
1801 [translateBubbleController_ showWindow:nil]; 1804 [translateBubbleController_ showWindow:nil];
1802 1805
1803 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; 1806 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
1804 [center addObserver:self 1807 [center addObserver:self
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2305 2308
2306 - (BOOL)supportsBookmarkBar { 2309 - (BOOL)supportsBookmarkBar {
2307 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2310 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2308 } 2311 }
2309 2312
2310 - (BOOL)isTabbedWindow { 2313 - (BOOL)isTabbedWindow {
2311 return browser_->is_type_tabbed(); 2314 return browser_->is_type_tabbed();
2312 } 2315 }
2313 2316
2314 @end // @implementation BrowserWindowController(WindowType) 2317 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_ui_delegate.cc ('k') | chrome/browser/ui/cocoa/infobars/translate_infobar_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698