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

Side by Side Diff: chrome/browser/ui/cocoa/find_bar/find_bar_bridge.mm

Issue 2848883005: Test FindBar audible alerts. (Closed)
Patch Set: Address Scott's comment. Created 3 years, 7 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
OLDNEW
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 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" 6 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h"
7 7
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" 9 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h"
10 #include "ui/gfx/range/range.h" 10 #include "ui/gfx/range/range.h"
11 11
12 // static 12 // static
13 bool FindBarBridge::disable_animations_during_testing_ = false; 13 bool FindBarBridge::disable_animations_during_testing_ = false;
14 14
15 FindBarBridge::FindBarBridge(Browser* browser) 15 FindBarBridge::FindBarBridge(Browser* browser)
16 : find_bar_controller_(NULL) { 16 : find_bar_controller_(NULL), audible_alerts_(0) {
17 cocoa_controller_ = [[FindBarCocoaController alloc] initWithBrowser:browser]; 17 cocoa_controller_ = [[FindBarCocoaController alloc] initWithBrowser:browser];
18 [cocoa_controller_ setFindBarBridge:this]; 18 [cocoa_controller_ setFindBarBridge:this];
19 } 19 }
20 20
21 FindBarBridge::~FindBarBridge() { 21 FindBarBridge::~FindBarBridge() {
22 [cocoa_controller_ release]; 22 [cocoa_controller_ release];
23 } 23 }
24 24
25 void FindBarBridge::SetFindBarController( 25 void FindBarBridge::SetFindBarController(
26 FindBarController* find_bar_controller) { 26 FindBarController* find_bar_controller) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return gfx::Range([cocoa_controller_ selectedRange]); 68 return gfx::Range([cocoa_controller_ selectedRange]);
69 } 69 }
70 70
71 void FindBarBridge::UpdateUIForFindResult(const FindNotificationDetails& result, 71 void FindBarBridge::UpdateUIForFindResult(const FindNotificationDetails& result,
72 const base::string16& find_text) { 72 const base::string16& find_text) {
73 [cocoa_controller_ updateUIForFindResult:result withText:find_text]; 73 [cocoa_controller_ updateUIForFindResult:result withText:find_text];
74 } 74 }
75 75
76 void FindBarBridge::AudibleAlert() { 76 void FindBarBridge::AudibleAlert() {
77 // Beep beep, beep beep, Yeah! 77 // Beep beep, beep beep, Yeah!
78 ++audible_alerts_;
78 NSBeep(); 79 NSBeep();
79 } 80 }
80 81
81 bool FindBarBridge::IsFindBarVisible() { 82 bool FindBarBridge::IsFindBarVisible() {
82 return [cocoa_controller_ isFindBarVisible] ? true : false; 83 return [cocoa_controller_ isFindBarVisible] ? true : false;
83 } 84 }
84 85
85 void FindBarBridge::MoveWindowIfNecessary(const gfx::Rect& selection_rect) { 86 void FindBarBridge::MoveWindowIfNecessary(const gfx::Rect& selection_rect) {
86 // See FindBarCocoaController moveFindBarToAvoidRect. 87 // See FindBarCocoaController moveFindBarToAvoidRect.
87 } 88 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return base::string16(); 127 return base::string16();
127 } 128 }
128 129
129 base::string16 FindBarBridge::GetMatchCountText() { 130 base::string16 FindBarBridge::GetMatchCountText() {
130 return base::SysNSStringToUTF16([cocoa_controller_ matchCountText]); 131 return base::SysNSStringToUTF16([cocoa_controller_ matchCountText]);
131 } 132 }
132 133
133 int FindBarBridge::GetWidth() { 134 int FindBarBridge::GetWidth() {
134 return [cocoa_controller_ findBarWidth]; 135 return [cocoa_controller_ findBarWidth];
135 } 136 }
137
138 size_t FindBarBridge::GetAudibleAlertCount() {
139 return audible_alerts_;
140 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h ('k') | chrome/browser/ui/find_bar/find_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698