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

Side by Side Diff: chrome/browser/cocoa/find_bar_bridge.h

Issue 1061003: [Mac] Makes ctrl-return follow links when finding in page.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 | chrome/browser/cocoa/find_bar_bridge.mm » ('j') | 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) 2010 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 #ifndef CHROME_BROWSER_COCOA_FIND_BAR_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_COCOA_FIND_BAR_BRIDGE_H_
6 #define CHROME_BROWSER_COCOA_FIND_BAR_BRIDGE_H_ 6 #define CHROME_BROWSER_COCOA_FIND_BAR_BRIDGE_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #include "base/logging.h"
9 9 #include "chrome/browser/find_bar.h"
10 #import "base/logging.h"
11 #import "base/scoped_nsobject.h"
12 #import "chrome/browser/find_bar.h"
13 10
14 class BrowserWindowCocoa; 11 class BrowserWindowCocoa;
15 class FindBarController; 12 class FindBarController;
13
14 // This class is included by find_bar_host_browsertest.cc, so it has to be
15 // objc-free.
16 #ifdef __OBJC__
16 @class FindBarCocoaController; 17 @class FindBarCocoaController;
18 #else
19 class FindBarCocoaController;
20 #endif
17 21
18 // Implementation of FindBar for the Mac. This class simply passes 22 // Implementation of FindBar for the Mac. This class simply passes
19 // each message along to |cocoa_controller_|. 23 // each message along to |cocoa_controller_|.
20 // 24 //
21 // The initialization here is a bit complicated. FindBarBridge is 25 // The initialization here is a bit complicated. FindBarBridge is
22 // created by a static method in BrowserWindow. The FindBarBridge 26 // created by a static method in BrowserWindow. The FindBarBridge
23 // constructor creates a FindBarCocoaController, which in turn loads a 27 // constructor creates a FindBarCocoaController, which in turn loads a
24 // FindBarView from a nib file. All of this is happening outside of 28 // FindBarView from a nib file. All of this is happening outside of
25 // the main view hierarchy, so the static method also calls 29 // the main view hierarchy, so the static method also calls
26 // BrowserWindowCocoa::AddFindBar() in order to add its FindBarView to 30 // BrowserWindowCocoa::AddFindBar() in order to add its FindBarView to
27 // the cocoa views hierarchy. 31 // the cocoa views hierarchy.
28 // 32 //
29 // Memory ownership is relatively straightfoward. The FindBarBridge 33 // Memory ownership is relatively straightfoward. The FindBarBridge
30 // object is owned by the Browser. FindBarCocoaController is retained 34 // object is owned by the Browser. FindBarCocoaController is retained
31 // by bother FindBarBridge and BrowserWindowController, since both use it. 35 // by bother FindBarBridge and BrowserWindowController, since both use it.
32 36
33 class FindBarBridge : public FindBar { 37 class FindBarBridge : public FindBar,
38 public FindBarTesting {
34 public: 39 public:
35 FindBarBridge(); 40 FindBarBridge();
36 virtual ~FindBarBridge(); 41 virtual ~FindBarBridge();
37 42
38 FindBarCocoaController* find_bar_cocoa_controller() { 43 FindBarCocoaController* find_bar_cocoa_controller() {
39 return cocoa_controller_.get(); 44 return cocoa_controller_;
40 } 45 }
41 46
42 virtual void SetFindBarController(FindBarController* find_bar_controller) { 47 virtual void SetFindBarController(FindBarController* find_bar_controller) {
43 find_bar_controller_ = find_bar_controller; 48 find_bar_controller_ = find_bar_controller;
44 } 49 }
45 50
46 virtual FindBarController* GetFindBarController() const { 51 virtual FindBarController* GetFindBarController() const {
47 DCHECK(find_bar_controller_); 52 DCHECK(find_bar_controller_);
48 return find_bar_controller_; 53 return find_bar_controller_;
49 } 54 }
50 55
51 virtual FindBarTesting* GetFindBarTesting() { 56 virtual FindBarTesting* GetFindBarTesting() {
52 NOTIMPLEMENTED(); 57 return this;
53 return NULL;
54 } 58 }
55 59
56 // Methods from FindBar. 60 // Methods from FindBar.
57 virtual void Show(bool animate); 61 virtual void Show(bool animate);
58 virtual void Hide(bool animate); 62 virtual void Hide(bool animate);
59 virtual void SetFocusAndSelection(); 63 virtual void SetFocusAndSelection();
60 virtual void ClearResults(const FindNotificationDetails& results); 64 virtual void ClearResults(const FindNotificationDetails& results);
61 virtual void StopAnimation(); 65 virtual void StopAnimation();
62 virtual void SetFindText(const string16& find_text); 66 virtual void SetFindText(const string16& find_text);
63 virtual void UpdateUIForFindResult(const FindNotificationDetails& result, 67 virtual void UpdateUIForFindResult(const FindNotificationDetails& result,
64 const string16& find_text); 68 const string16& find_text);
65 virtual void AudibleAlert(); 69 virtual void AudibleAlert();
66 virtual bool IsFindBarVisible(); 70 virtual bool IsFindBarVisible();
67 virtual void RestoreSavedFocus(); 71 virtual void RestoreSavedFocus();
68 virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect, 72 virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect,
69 bool no_redraw); 73 bool no_redraw);
70 74
75 // Methods from FindBarTesting.
76 virtual bool GetFindBarWindowInfo(gfx::Point* position,
77 bool* fully_visible);
78
79 // Used to disable find bar animations when testing.
80 static bool disable_animations_during_testing_;
81
71 private: 82 private:
72 // Pointer to the cocoa controller which manages the cocoa view. Is 83 // Pointer to the cocoa controller which manages the cocoa view. Is
73 // never null. 84 // never nil.
74 scoped_nsobject<FindBarCocoaController> cocoa_controller_; 85 FindBarCocoaController* cocoa_controller_;
75 86
76 // Pointer back to the owning controller. 87 // Pointer back to the owning controller.
77 FindBarController* find_bar_controller_; // weak, owns us 88 FindBarController* find_bar_controller_; // weak, owns us
78 89
79 DISALLOW_COPY_AND_ASSIGN(FindBarBridge); 90 DISALLOW_COPY_AND_ASSIGN(FindBarBridge);
80 }; 91 };
81 92
82 #endif // CHROME_BROWSER_COCOA_FIND_BAR_BRIDGE_H_ 93 #endif // CHROME_BROWSER_COCOA_FIND_BAR_BRIDGE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/find_bar_bridge.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698