| OLD | NEW |
| 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_FIND_BAR_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_FIND_BAR_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_FIND_BAR_CONTROLLER_H_ | 6 #define CHROME_BROWSER_FIND_BAR_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "chrome/common/notification_registrar.h" | 11 #include "chrome/common/notification_registrar.h" |
| 12 | 12 |
| 13 class FindBar; | 13 class FindBar; |
| 14 class TabContents; | 14 class TabContents; |
| 15 | 15 |
| 16 class FindBarController : public NotificationObserver { | 16 class FindBarController : public NotificationObserver { |
| 17 public: | 17 public: |
| 18 // An enum listing the possible actions to take on a find-in-page selection. |
| 19 enum SelectionAction { |
| 20 kKeepSelection, // Translate the find selection into a normal selection. |
| 21 kClearSelection, // Clear the find selection. |
| 22 kActivateSelection // Focus and click the selected node (for links). |
| 23 }; |
| 24 |
| 18 // FindBar takes ownership of |find_bar_view|. | 25 // FindBar takes ownership of |find_bar_view|. |
| 19 explicit FindBarController(FindBar* find_bar); | 26 explicit FindBarController(FindBar* find_bar); |
| 20 | 27 |
| 21 virtual ~FindBarController(); | 28 virtual ~FindBarController(); |
| 22 | 29 |
| 23 // Shows the find bar. Any previous search string will again be visible. | 30 // Shows the find bar. Any previous search string will again be visible. |
| 24 void Show(); | 31 void Show(); |
| 25 | 32 |
| 26 // Ends the current session. | 33 // Ends the current session. |
| 27 void EndFindSession(); | 34 void EndFindSession(SelectionAction action); |
| 28 | 35 |
| 29 // Accessor for the attached TabContents. | 36 // Accessor for the attached TabContents. |
| 30 TabContents* tab_contents() const { return tab_contents_; } | 37 TabContents* tab_contents() const { return tab_contents_; } |
| 31 | 38 |
| 32 // Changes the TabContents that this FindBar is attached to. This occurs when | 39 // Changes the TabContents that this FindBar is attached to. This occurs when |
| 33 // the user switches tabs in the Browser window. |contents| can be NULL. | 40 // the user switches tabs in the Browser window. |contents| can be NULL. |
| 34 void ChangeTabContents(TabContents* contents); | 41 void ChangeTabContents(TabContents* contents); |
| 35 | 42 |
| 36 // Overridden from NotificationObserver: | 43 // Overridden from NotificationObserver: |
| 37 virtual void Observe(NotificationType type, | 44 virtual void Observe(NotificationType type, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 61 TabContents* tab_contents_; | 68 TabContents* tab_contents_; |
| 62 | 69 |
| 63 // The last match count we reported to the user. This is used by | 70 // The last match count we reported to the user. This is used by |
| 64 // UpdateFindBarForCurrentResult to avoid flickering. | 71 // UpdateFindBarForCurrentResult to avoid flickering. |
| 65 int last_reported_matchcount_; | 72 int last_reported_matchcount_; |
| 66 | 73 |
| 67 DISALLOW_COPY_AND_ASSIGN(FindBarController); | 74 DISALLOW_COPY_AND_ASSIGN(FindBarController); |
| 68 }; | 75 }; |
| 69 | 76 |
| 70 #endif // CHROME_BROWSER_FIND_BAR_CONTROLLER_H_ | 77 #endif // CHROME_BROWSER_FIND_BAR_CONTROLLER_H_ |
| OLD | NEW |