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

Unified Diff: chrome/browser/ui/omnibox/omnibox_edit_model.h

Issue 11413217: Instant API: tell page whether the browser is capturing key strokes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@focus
Patch Set: Fixed comments, mouse handling logic. Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/omnibox/omnibox_edit_model.h
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.h b/chrome/browser/ui/omnibox/omnibox_edit_model.h
index f8444f67bb086fe528660a87a103a257bdf3e1f8..a6b25381d52e2607ffce91be013ff3336825e847 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.h
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.h
@@ -12,6 +12,7 @@
#include "base/time.h"
#include "chrome/browser/autocomplete/autocomplete_controller_delegate.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
+#include "chrome/common/instant_types.h"
#include "chrome/common/metrics/proto/omnibox_event.pb.h"
#include "content/public/common/page_transition_types.h"
#include "googleurl/src/gurl.h"
@@ -217,12 +218,13 @@ class OmniboxEditModel : public AutocompleteControllerDelegate {
void OnSetFocus(bool control_down);
// Sets the visibility of the caret in the omnibox, if it has focus. The
- // visibility of the caret is reset to visible if any of the following
- // happens:
- // - User starts typing in the omnibox
- // - User clicks in the omnibox
- // - Omnibox loses and then regains focus
- // - SetFocus() is explicitly called again
+ // visibility of the caret is reset to visible if either
+ // - The user starts typing, or
+ // - We explicitly focus the omnibox again.
+ // The latter case must be handled in three separate places--OnSetFocus(),
+ // OmniboxView::SetFocus(), and the mouse handlers in OmniboxView. See
+ // accompanying comments for why each of these is necessary.
+ //
// Caret visibility is tracked per-tab and updates automatically upon
// switching tabs.
void SetCaretVisibility(bool visible);
@@ -407,6 +409,11 @@ class OmniboxEditModel : public AutocompleteControllerDelegate {
AutocompleteMatch* match,
GURL* alternate_nav_url) const;
+ // Helper for SetCaretVisibility. |reason| is the reason for change that is
+ // passed down to InstantController when we notify it of focus state changes.
Peter Kasting 2012/12/07 23:22:03 Nit: How about: Actually changes the current care
samarth 2012/12/08 00:55:47 Done.
+ void SetCaretVisibilityInternal(bool visible,
+ OmniboxFocusChangeReason reason);
+
scoped_ptr<AutocompleteController> autocomplete_controller_;
OmniboxView* view_;

Powered by Google App Engine
This is Rietveld 408576698