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

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

Issue 151283006: Mac OS X: Show the Translate icon on Omnibox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue-307352-translate-bubble-2
Patch Set: Use kAnimateNone Created 6 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
11 #import "base/mac/sdk_forward_declarations.h" 11 #import "base/mac/sdk_forward_declarations.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
15 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/download/download_shelf.h" 17 #include "chrome/browser/download/download_shelf.h"
18 #include "chrome/browser/extensions/tab_helper.h" 18 #include "chrome/browser/extensions/tab_helper.h"
19 #include "chrome/browser/fullscreen.h" 19 #include "chrome/browser/fullscreen.h"
20 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 20 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/shell_integration.h" 22 #include "chrome/browser/shell_integration.h"
23 #include "chrome/browser/translate/translate_tab_helper.h"
23 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_command_controller.h" 25 #include "chrome/browser/ui/browser_command_controller.h"
25 #include "chrome/browser/ui/browser_commands_mac.h" 26 #include "chrome/browser/ui/browser_commands_mac.h"
26 #include "chrome/browser/ui/browser_list.h" 27 #include "chrome/browser/ui/browser_list.h"
27 #include "chrome/browser/ui/browser_window_state.h" 28 #include "chrome/browser/ui/browser_window_state.h"
28 #import "chrome/browser/ui/cocoa/browser/avatar_base_controller.h" 29 #import "chrome/browser/ui/cocoa/browser/avatar_base_controller.h"
29 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" 30 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h"
30 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.h" 31 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.h"
31 #import "chrome/browser/ui/cocoa/browser/password_generation_bubble_controller.h " 32 #import "chrome/browser/ui/cocoa/browser/password_generation_bubble_controller.h "
32 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 33 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 void BrowserWindowCocoa::UpdateDevTools() { 279 void BrowserWindowCocoa::UpdateDevTools() {
279 [controller_ updateDevToolsForContents: 280 [controller_ updateDevToolsForContents:
280 browser_->tab_strip_model()->GetActiveWebContents()]; 281 browser_->tab_strip_model()->GetActiveWebContents()];
281 } 282 }
282 283
283 void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) { 284 void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) {
284 // Do nothing on Mac. 285 // Do nothing on Mac.
285 } 286 }
286 287
287 void BrowserWindowCocoa::SetStarredState(bool is_starred) { 288 void BrowserWindowCocoa::SetStarredState(bool is_starred) {
288 [controller_ setStarredState:is_starred ? YES : NO]; 289 [controller_ setStarredState:is_starred];
289 } 290 }
290 291
291 void BrowserWindowCocoa::SetTranslateIconToggled(bool is_lit) { 292 void BrowserWindowCocoa::SetTranslateIconToggled(bool is_lit) {
292 NOTIMPLEMENTED(); 293 [controller_ setCurrentPageIsTranslated:is_lit];
293 } 294 }
294 295
295 void BrowserWindowCocoa::OnActiveTabChanged(content::WebContents* old_contents, 296 void BrowserWindowCocoa::OnActiveTabChanged(content::WebContents* old_contents,
296 content::WebContents* new_contents, 297 content::WebContents* new_contents,
297 int index, 298 int index,
298 int reason) { 299 int reason) {
299 // TODO(pkasting): Perhaps the code in 300 // TODO(pkasting): Perhaps the code in
300 // TabStripController::activateTabWithContents should move here? Or this 301 // TabStripController::activateTabWithContents should move here? Or this
301 // should call that (instead of TabStripModelObserverBridge doing so)? It's 302 // should call that (instead of TabStripModelObserverBridge doing so)? It's
302 // not obvious to me why Mac doesn't handle tab changes in BrowserWindow the 303 // not obvious to me why Mac doesn't handle tab changes in BrowserWindow the
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 void BrowserWindowCocoa::ShowBookmarkAppBubble( 488 void BrowserWindowCocoa::ShowBookmarkAppBubble(
488 const WebApplicationInfo& web_app_info, 489 const WebApplicationInfo& web_app_info,
489 const std::string& extension_id) { 490 const std::string& extension_id) {
490 NOTIMPLEMENTED(); 491 NOTIMPLEMENTED();
491 } 492 }
492 493
493 void BrowserWindowCocoa::ShowTranslateBubble( 494 void BrowserWindowCocoa::ShowTranslateBubble(
494 content::WebContents* contents, 495 content::WebContents* contents,
495 TranslateTabHelper::TranslateStep step, 496 TranslateTabHelper::TranslateStep step,
496 TranslateErrors::Type error_type) { 497 TranslateErrors::Type error_type) {
497 NOTIMPLEMENTED(); 498 TranslateTabHelper* translate_tab_helper =
499 TranslateTabHelper::FromWebContents(contents);
500 LanguageState& language_state = translate_tab_helper->GetLanguageState();
501 language_state.SetTranslateEnabled(true);
502
503 [controller_ showTranslateBubbleForWebContents:contents
504 step:step
505 errorType:error_type];
498 } 506 }
499 507
500 #if defined(ENABLE_ONE_CLICK_SIGNIN) 508 #if defined(ENABLE_ONE_CLICK_SIGNIN)
501 void BrowserWindowCocoa::ShowOneClickSigninBubble( 509 void BrowserWindowCocoa::ShowOneClickSigninBubble(
502 OneClickSigninBubbleType type, 510 OneClickSigninBubbleType type,
503 const base::string16& email, 511 const base::string16& email,
504 const base::string16& error_message, 512 const base::string16& error_message,
505 const StartSyncCallback& start_sync_callback) { 513 const StartSyncCallback& start_sync_callback) {
506 WebContents* web_contents = 514 WebContents* web_contents =
507 browser_->tab_strip_model()->GetActiveWebContents(); 515 browser_->tab_strip_model()->GetActiveWebContents();
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 778
771 void BrowserWindowCocoa::ShowPageActionPopup( 779 void BrowserWindowCocoa::ShowPageActionPopup(
772 const extensions::Extension* extension) { 780 const extensions::Extension* extension) {
773 [cocoa_controller() activatePageAction:extension->id()]; 781 [cocoa_controller() activatePageAction:extension->id()];
774 } 782 }
775 783
776 void BrowserWindowCocoa::ShowBrowserActionPopup( 784 void BrowserWindowCocoa::ShowBrowserActionPopup(
777 const extensions::Extension* extension) { 785 const extensions::Extension* extension) {
778 [cocoa_controller() activateBrowserAction:extension->id()]; 786 [cocoa_controller() activateBrowserAction:extension->id()];
779 } 787 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698