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

Side by Side Diff: chrome/browser/cocoa/find_bar_cocoa_controller.mm

Issue 661024: [Mac] Do not copy to the find pasteboard when in Incognito mode.... Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/find_bar_controller.h" 9 #include "chrome/browser/find_bar_controller.h"
10 #include "chrome/browser/profile.h"
10 #include "chrome/browser/cocoa/browser_window_cocoa.h" 11 #include "chrome/browser/cocoa/browser_window_cocoa.h"
11 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" 12 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h"
12 #import "chrome/browser/cocoa/find_bar_bridge.h" 13 #import "chrome/browser/cocoa/find_bar_bridge.h"
13 #import "chrome/browser/cocoa/find_bar_text_field.h" 14 #import "chrome/browser/cocoa/find_bar_text_field.h"
14 #import "chrome/browser/cocoa/find_bar_text_field_cell.h" 15 #import "chrome/browser/cocoa/find_bar_text_field_cell.h"
15 #import "chrome/browser/cocoa/find_pasteboard.h" 16 #import "chrome/browser/cocoa/find_pasteboard.h"
16 #import "chrome/browser/cocoa/focus_tracker.h" 17 #import "chrome/browser/cocoa/focus_tracker.h"
17 #import "chrome/browser/cocoa/tab_strip_controller.h" 18 #import "chrome/browser/cocoa/tab_strip_controller.h"
18 #include "chrome/browser/renderer_host/render_view_host.h" 19 #include "chrome/browser/renderer_host/render_view_host.h"
19 #include "chrome/browser/tab_contents/tab_contents.h" 20 #include "chrome/browser/tab_contents/tab_contents.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 - (void)controlTextDidChange:(NSNotification *)aNotification { 121 - (void)controlTextDidChange:(NSNotification *)aNotification {
121 if (!findBarBridge_) 122 if (!findBarBridge_)
122 return; 123 return;
123 124
124 TabContents* tab_contents = 125 TabContents* tab_contents =
125 findBarBridge_->GetFindBarController()->tab_contents(); 126 findBarBridge_->GetFindBarController()->tab_contents();
126 if (!tab_contents) 127 if (!tab_contents)
127 return; 128 return;
128 129
129 NSString* findText = [findText_ stringValue]; 130 NSString* findText = [findText_ stringValue];
130 suppressPboardUpdateActions_ = YES; 131
131 [[FindPasteboard sharedInstance] setFindText:findText]; 132 // Do not update the find pasteboard if in Incognito mode.
132 suppressPboardUpdateActions_ = NO; 133 if (!tab_contents->profile()->IsOffTheRecord()) {
134 suppressPboardUpdateActions_ = YES;
135 [[FindPasteboard sharedInstance] setFindText:findText];
136 suppressPboardUpdateActions_ = NO;
137 }
133 138
134 if ([findText length] > 0) { 139 if ([findText length] > 0) {
135 tab_contents->StartFinding(base::SysNSStringToUTF16(findText), true, false); 140 tab_contents->StartFinding(base::SysNSStringToUTF16(findText), true, false);
136 } else { 141 } else {
137 // The textbox is empty so we reset. 142 // The textbox is empty so we reset.
138 tab_contents->StopFinding(true); // true = clear selection on page. 143 tab_contents->StopFinding(true); // true = clear selection on page.
139 [self updateUIForFindResult:tab_contents->find_result() 144 [self updateUIForFindResult:tab_contents->find_result()
140 withText:string16()]; 145 withText:string16()];
141 } 146 }
142 } 147 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 366 }
362 } 367 }
363 368
364 // Has to happen after |ClearResults()| above. 369 // Has to happen after |ClearResults()| above.
365 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; 370 BOOL buttonsEnabled = [text length] > 0 ? YES : NO;
366 [previousButton_ setEnabled:buttonsEnabled]; 371 [previousButton_ setEnabled:buttonsEnabled];
367 [nextButton_ setEnabled:buttonsEnabled]; 372 [nextButton_ setEnabled:buttonsEnabled];
368 } 373 }
369 374
370 @end 375 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698