| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/find_bar_bridge.h" | 5 #import "chrome/browser/cocoa/find_bar_bridge.h" |
| 6 |
| 7 #include "base/sys_string_conversions.h" |
| 6 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" | 8 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" |
| 7 | 9 |
| 8 FindBarBridge::FindBarBridge() { | 10 FindBarBridge::FindBarBridge() { |
| 9 cocoa_controller_.reset([[FindBarCocoaController alloc] init]); | 11 cocoa_controller_.reset([[FindBarCocoaController alloc] init]); |
| 10 [cocoa_controller_ setFindBarBridge:this]; | 12 [cocoa_controller_ setFindBarBridge:this]; |
| 11 } | 13 } |
| 12 | 14 |
| 13 FindBarBridge::~FindBarBridge() { | 15 FindBarBridge::~FindBarBridge() { |
| 14 } | 16 } |
| 15 | 17 |
| 16 void FindBarBridge::Show() { | 18 void FindBarBridge::Show() { |
| 17 [cocoa_controller_ showFindBar:YES]; // with animation. | 19 [cocoa_controller_ showFindBar:YES]; // with animation. |
| 18 } | 20 } |
| 19 | 21 |
| 20 void FindBarBridge::Hide(bool animate) { | 22 void FindBarBridge::Hide(bool animate) { |
| 21 [cocoa_controller_ hideFindBar:(animate ? YES : NO)]; | 23 [cocoa_controller_ hideFindBar:(animate ? YES : NO)]; |
| 22 } | 24 } |
| 23 | 25 |
| 24 void FindBarBridge::SetFocusAndSelection() { | 26 void FindBarBridge::SetFocusAndSelection() { |
| 25 [cocoa_controller_ setFocusAndSelection]; | 27 [cocoa_controller_ setFocusAndSelection]; |
| 26 } | 28 } |
| 27 | 29 |
| 28 void FindBarBridge::ClearResults(const FindNotificationDetails& results) { | 30 void FindBarBridge::ClearResults(const FindNotificationDetails& results) { |
| 29 [cocoa_controller_ clearResults:results]; | 31 [cocoa_controller_ clearResults:results]; |
| 30 } | 32 } |
| 31 | 33 |
| 32 void FindBarBridge::SetFindText(const string16& find_text) { | 34 void FindBarBridge::SetFindText(const string16& find_text) { |
| 33 [cocoa_controller_ setFindText:find_text]; | 35 [cocoa_controller_ setFindText:base::SysUTF16ToNSString(find_text)]; |
| 34 } | 36 } |
| 35 | 37 |
| 36 void FindBarBridge::UpdateUIForFindResult(const FindNotificationDetails& result, | 38 void FindBarBridge::UpdateUIForFindResult(const FindNotificationDetails& result, |
| 37 const string16& find_text) { | 39 const string16& find_text) { |
| 38 [cocoa_controller_ updateUIForFindResult:result withText:find_text]; | 40 [cocoa_controller_ updateUIForFindResult:result withText:find_text]; |
| 39 } | 41 } |
| 40 | 42 |
| 41 void FindBarBridge::AudibleAlert() { | 43 void FindBarBridge::AudibleAlert() { |
| 42 // TODO(rohitrao): Beep beep, beep beep, Yeah! | 44 // TODO(rohitrao): Beep beep, beep beep, Yeah! |
| 43 } | 45 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 63 void FindBarBridge::SetDialogPosition(const gfx::Rect& new_pos, | 65 void FindBarBridge::SetDialogPosition(const gfx::Rect& new_pos, |
| 64 bool no_redraw) { | 66 bool no_redraw) { |
| 65 // TODO(rohitrao): Do something useful here. For now, just show the findbar. | 67 // TODO(rohitrao): Do something useful here. For now, just show the findbar. |
| 66 // http://crbug.com/22036 | 68 // http://crbug.com/22036 |
| 67 [cocoa_controller_ showFindBar:NO]; // Do not animate. | 69 [cocoa_controller_ showFindBar:NO]; // Do not animate. |
| 68 } | 70 } |
| 69 | 71 |
| 70 void FindBarBridge::RestoreSavedFocus() { | 72 void FindBarBridge::RestoreSavedFocus() { |
| 71 [cocoa_controller_ restoreSavedFocus]; | 73 [cocoa_controller_ restoreSavedFocus]; |
| 72 } | 74 } |
| OLD | NEW |