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

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

Issue 203223002: Translate bubble for Mac OS X (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (rebasing) 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
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"
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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 if (step != TranslateTabHelper::TRANSLATE_ERROR) { 1779 if (step != TranslateTabHelper::TRANSLATE_ERROR) {
1779 TranslateBubbleModel::ViewState viewState = 1780 TranslateBubbleModel::ViewState viewState =
1780 TranslateBubbleModelImpl::TranslateStepToViewState(step); 1781 TranslateBubbleModelImpl::TranslateStepToViewState(step);
1781 [translateBubbleController_ switchView:viewState]; 1782 [translateBubbleController_ switchView:viewState];
1782 } else { 1783 } else {
1783 [translateBubbleController_ switchToErrorView:errorType]; 1784 [translateBubbleController_ switchToErrorView:errorType];
1784 } 1785 }
1785 return; 1786 return;
1786 } 1787 }
1787 1788
1788 // TODO(hajimehoshi): Set the initial languages correctly. 1789 std::string sourceLanguage;
1789 std::string sourceLanguage = "xx"; 1790 std::string targetLanguage;
1790 std::string targetLanguage = "yy"; 1791 TranslateTabHelper::GetTranslateLanguages(contents,
1792 &sourceLanguage, &targetLanguage);
1791 1793
1792 scoped_ptr<TranslateUIDelegate> uiDelegate( 1794 scoped_ptr<TranslateUIDelegate> uiDelegate(
1793 new TranslateUIDelegate(contents, sourceLanguage, targetLanguage)); 1795 new TranslateUIDelegate(contents, sourceLanguage, targetLanguage));
1794 scoped_ptr<TranslateBubbleModel> model( 1796 scoped_ptr<TranslateBubbleModel> model(
1795 new TranslateBubbleModelImpl(step, uiDelegate.Pass())); 1797 new TranslateBubbleModelImpl(step, uiDelegate.Pass()));
1796 translateBubbleController_ = [[TranslateBubbleController alloc] 1798 translateBubbleController_ = [[TranslateBubbleController alloc]
1797 initWithParentWindow:self 1799 initWithParentWindow:self
1798 model:model.Pass() 1800 model:model.Pass()
1799 webContents:contents]; 1801 webContents:contents];
1800 [translateBubbleController_ showWindow:nil]; 1802 [translateBubbleController_ showWindow:nil];
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 2306
2305 - (BOOL)supportsBookmarkBar { 2307 - (BOOL)supportsBookmarkBar {
2306 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2308 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2307 } 2309 }
2308 2310
2309 - (BOOL)isTabbedWindow { 2311 - (BOOL)isTabbedWindow {
2310 return browser_->is_type_tabbed(); 2312 return browser_->is_type_tabbed();
2311 } 2313 }
2312 2314
2313 @end // @implementation BrowserWindowController(WindowType) 2315 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_tab_helper.cc ('k') | chrome/browser/ui/cocoa/translate/translate_bubble_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698