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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.h

Issue 11418144: [Search] Implementation of the invisible focus on Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@samarthlatest
Patch Set: Rebased to master instead of other change 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ 5 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_
6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ 6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 19 matching lines...) Expand all
30 class Image; 30 class Image;
31 class Rect; 31 class Rect;
32 } 32 }
33 33
34 class OmniboxEditModel : public AutocompleteControllerDelegate { 34 class OmniboxEditModel : public AutocompleteControllerDelegate {
35 public: 35 public:
36 struct State { 36 struct State {
37 State(bool user_input_in_progress, 37 State(bool user_input_in_progress,
38 const string16& user_text, 38 const string16& user_text,
39 const string16& keyword, 39 const string16& keyword,
40 bool is_keyword_hint); 40 bool is_keyword_hint,
41 bool is_focus_visible);
41 ~State(); 42 ~State();
42 43
43 bool user_input_in_progress; 44 bool user_input_in_progress;
44 const string16 user_text; 45 const string16 user_text;
45 const string16 keyword; 46 const string16 keyword;
46 const bool is_keyword_hint; 47 const bool is_keyword_hint;
48 const bool is_focus_visible;
47 }; 49 };
48 50
49 OmniboxEditModel(OmniboxView* view, 51 OmniboxEditModel(OmniboxView* view,
50 OmniboxEditController* controller, 52 OmniboxEditController* controller,
51 Profile* profile); 53 Profile* profile);
52 virtual ~OmniboxEditModel(); 54 virtual ~OmniboxEditModel();
53 55
54 AutocompleteController* autocomplete_controller() const { 56 AutocompleteController* autocomplete_controller() const {
55 return autocomplete_controller_.get(); 57 return autocomplete_controller_.get();
56 } 58 }
57 59
58 void set_popup_model(OmniboxPopupModel* popup_model) { 60 void set_popup_model(OmniboxPopupModel* popup_model) {
59 popup_ = popup_model; 61 popup_ = popup_model;
60 } 62 }
61 63
62 // TODO: The edit and popup should be siblings owned by the LocationBarView, 64 // TODO: The edit and popup should be siblings owned by the LocationBarView,
63 // making this accessor unnecessary. 65 // making this accessor unnecessary.
64 OmniboxPopupModel* popup_model() const { return popup_; } 66 OmniboxPopupModel* popup_model() const { return popup_; }
65 67
66 OmniboxEditController* controller() const { return controller_; } 68 OmniboxEditController* controller() const { return controller_; }
67 69
68 Profile* profile() const { return profile_; } 70 Profile* profile() const { return profile_; }
69 71
72 bool is_focus_visible() { return is_focus_visible_; }
73
74 void set_is_focus_visible(bool value) { is_focus_visible_ = value; }
75
70 // Returns the current state. This assumes we are switching tabs, and changes 76 // Returns the current state. This assumes we are switching tabs, and changes
71 // the internal state appropriately. 77 // the internal state appropriately.
72 const State GetStateForTabSwitch(); 78 const State GetStateForTabSwitch();
73 79
74 // Restores local state from the saved |state|. 80 // Restores local state from the saved |state|.
75 void RestoreState(const State& state); 81 void RestoreState(const State& state);
76 82
77 // Returns the match for the current text. If the user has not edited the text 83 // Returns the match for the current text. If the user has not edited the text
78 // this is the match corresponding to the permanent text. 84 // this is the match corresponding to the permanent text.
79 AutocompleteMatch CurrentMatch(); 85 AutocompleteMatch CurrentMatch();
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 403
398 OmniboxView* view_; 404 OmniboxView* view_;
399 405
400 OmniboxPopupModel* popup_; 406 OmniboxPopupModel* popup_;
401 407
402 OmniboxEditController* controller_; 408 OmniboxEditController* controller_;
403 409
404 // Whether the edit has focus. 410 // Whether the edit has focus.
405 bool has_focus_; 411 bool has_focus_;
406 412
413 // Will the focus be visible? Note that this does NOT describe whether the
414 // omnibox currently has focus, only whether focusing will be visible when
415 // it is focused.
416 bool is_focus_visible_;
417
407 // The URL of the currently displayed page. 418 // The URL of the currently displayed page.
408 string16 permanent_text_; 419 string16 permanent_text_;
409 420
410 // This flag is true when the user has modified the contents of the edit, but 421 // This flag is true when the user has modified the contents of the edit, but
411 // not yet accepted them. We use this to determine when we need to save 422 // not yet accepted them. We use this to determine when we need to save
412 // state (on switching tabs) and whether changes to the page URL should be 423 // state (on switching tabs) and whether changes to the page URL should be
413 // immediately displayed. 424 // immediately displayed.
414 // This flag will be true in a superset of the cases where the popup is open. 425 // This flag will be true in a superset of the cases where the popup is open.
415 bool user_input_in_progress_; 426 bool user_input_in_progress_;
416 427
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // an exact keyword match. If this is true then keyword mode will be 515 // an exact keyword match. If this is true then keyword mode will be
505 // triggered automatically if the input is "<keyword> <search string>". We 516 // triggered automatically if the input is "<keyword> <search string>". We
506 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. 517 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true.
507 // This has no effect if we're already in keyword mode. 518 // This has no effect if we're already in keyword mode.
508 bool allow_exact_keyword_match_; 519 bool allow_exact_keyword_match_;
509 520
510 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); 521 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel);
511 }; 522 };
512 523
513 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ 524 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698