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 if (!tab_contents->profile()->IsOffTheRecord()) { |
Robert Sesek
2011/06/08 14:46:06
Add a comment that references this bug so it's mor
| |
174 [[FindPasteboard sharedInstance] setFindText:findText]; | 176 AutoReset<BOOL> auto_reset(&suppressPboardUpdateActions_, YES); |
175 suppressPboardUpdateActions_ = NO; | 177 [[FindPasteboard sharedInstance] setFindText:findText]; |
178 } | |
176 | 179 |
177 if ([findText length] > 0) { | 180 if ([findText length] > 0) { |
178 find_tab_helper-> | 181 find_tab_helper-> |
179 StartFinding(base::SysNSStringToUTF16(findText), true, false); | 182 StartFinding(base::SysNSStringToUTF16(findText), true, false); |
180 } else { | 183 } else { |
181 // The textbox is empty so we reset. | 184 // The textbox is empty so we reset. |
182 find_tab_helper->StopFinding(FindBarController::kClearSelection); | 185 find_tab_helper->StopFinding(FindBarController::kClearSelection); |
183 [self updateUIForFindResult:find_tab_helper->find_result() | 186 [self updateUIForFindResult:find_tab_helper->find_result() |
184 withText:string16()]; | 187 withText:string16()]; |
185 } | 188 } |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 } | 528 } |
526 } | 529 } |
527 | 530 |
528 // Has to happen after |ClearResults()| above. | 531 // Has to happen after |ClearResults()| above. |
529 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; | 532 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; |
530 [previousButton_ setEnabled:buttonsEnabled]; | 533 [previousButton_ setEnabled:buttonsEnabled]; |
531 [nextButton_ setEnabled:buttonsEnabled]; | 534 [nextButton_ setEnabled:buttonsEnabled]; |
532 } | 535 } |
533 | 536 |
534 @end | 537 @end |
OLD | NEW |