| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/auto_reset.h" |
| 7 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 8 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 11 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" | 12 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
| 11 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 13 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 12 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h" | 14 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h" |
| 13 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h" | 15 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h" |
| 14 #import "chrome/browser/ui/cocoa/find_pasteboard.h" | 16 #import "chrome/browser/ui/cocoa/find_pasteboard.h" |
| 15 #import "chrome/browser/ui/cocoa/focus_tracker.h" | 17 #import "chrome/browser/ui/cocoa/focus_tracker.h" |
| 16 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 18 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
| 17 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 19 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| 18 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 20 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 if (!findBarBridge_) | 165 if (!findBarBridge_) |
| 164 return; | 166 return; |
| 165 | 167 |
| 166 TabContentsWrapper* tab_contents = | 168 TabContentsWrapper* tab_contents = |
| 167 findBarBridge_->GetFindBarController()->tab_contents(); | 169 findBarBridge_->GetFindBarController()->tab_contents(); |
| 168 if (!tab_contents) | 170 if (!tab_contents) |
| 169 return; | 171 return; |
| 170 FindTabHelper* find_tab_helper = tab_contents->find_tab_helper(); | 172 FindTabHelper* find_tab_helper = tab_contents->find_tab_helper(); |
| 171 | 173 |
| 172 NSString* findText = [findText_ stringValue]; | 174 NSString* findText = [findText_ stringValue]; |
| 173 suppressPboardUpdateActions_ = YES; | 175 // Only copy typed text to the FindPasteboard for non-incognito windows, see |
| 174 [[FindPasteboard sharedInstance] setFindText:findText]; | 176 // http://crbug.com/85306. |
| 175 suppressPboardUpdateActions_ = NO; | 177 if (!tab_contents->profile()->IsOffTheRecord()) { |
| 178 AutoReset<BOOL> auto_reset(&suppressPboardUpdateActions_, YES); |
| 179 [[FindPasteboard sharedInstance] setFindText:findText]; |
| 180 } |
| 176 | 181 |
| 177 if ([findText length] > 0) { | 182 if ([findText length] > 0) { |
| 178 find_tab_helper-> | 183 find_tab_helper-> |
| 179 StartFinding(base::SysNSStringToUTF16(findText), true, false); | 184 StartFinding(base::SysNSStringToUTF16(findText), true, false); |
| 180 } else { | 185 } else { |
| 181 // The textbox is empty so we reset. | 186 // The textbox is empty so we reset. |
| 182 find_tab_helper->StopFinding(FindBarController::kClearSelection); | 187 find_tab_helper->StopFinding(FindBarController::kClearSelection); |
| 183 [self updateUIForFindResult:find_tab_helper->find_result() | 188 [self updateUIForFindResult:find_tab_helper->find_result() |
| 184 withText:string16()]; | 189 withText:string16()]; |
| 185 } | 190 } |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 } | 530 } |
| 526 } | 531 } |
| 527 | 532 |
| 528 // Has to happen after |ClearResults()| above. | 533 // Has to happen after |ClearResults()| above. |
| 529 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; | 534 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; |
| 530 [previousButton_ setEnabled:buttonsEnabled]; | 535 [previousButton_ setEnabled:buttonsEnabled]; |
| 531 [nextButton_ setEnabled:buttonsEnabled]; | 536 [nextButton_ setEnabled:buttonsEnabled]; |
| 532 } | 537 } |
| 533 | 538 |
| 534 @end | 539 @end |
| OLD | NEW |