OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/search/instant_ipc_sender.h" | 5 #include "chrome/browser/ui/search/instant_ipc_sender.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
11 // Implementation for regular profiles. | 11 // Implementation for regular profiles. |
12 class InstantIPCSenderImpl : public InstantIPCSender { | 12 class InstantIPCSenderImpl : public InstantIPCSender { |
13 public: | 13 public: |
14 InstantIPCSenderImpl() {} | 14 InstantIPCSenderImpl() {} |
15 virtual ~InstantIPCSenderImpl() {} | 15 virtual ~InstantIPCSenderImpl() {} |
16 | 16 |
17 private: | 17 private: |
18 virtual void Update(const string16& text, | |
19 size_t selection_start, | |
20 size_t selection_end, | |
21 bool verbatim) OVERRIDE { | |
22 Send(new ChromeViewMsg_SearchBoxChange(routing_id(), text, verbatim, | |
23 selection_start, selection_end)); | |
24 } | |
25 | |
26 virtual void Submit(const string16& text) OVERRIDE { | 18 virtual void Submit(const string16& text) OVERRIDE { |
27 Send(new ChromeViewMsg_SearchBoxSubmit(routing_id(), text)); | 19 Send(new ChromeViewMsg_SearchBoxSubmit(routing_id(), text)); |
28 } | 20 } |
29 | 21 |
30 virtual void Cancel(const string16& text) OVERRIDE { | |
31 Send(new ChromeViewMsg_SearchBoxCancel(routing_id(), text)); | |
32 } | |
33 | |
34 virtual void SetPopupBounds(const gfx::Rect& bounds) OVERRIDE { | |
35 Send(new ChromeViewMsg_SearchBoxPopupResize(routing_id(), bounds)); | |
36 } | |
37 | |
38 virtual void SetOmniboxBounds(const gfx::Rect& bounds) OVERRIDE { | 22 virtual void SetOmniboxBounds(const gfx::Rect& bounds) OVERRIDE { |
39 Send(new ChromeViewMsg_SearchBoxMarginChange( | 23 Send(new ChromeViewMsg_SearchBoxMarginChange( |
40 routing_id(), bounds.x(), bounds.width())); | 24 routing_id(), bounds.x(), bounds.width())); |
41 } | 25 } |
42 | 26 |
43 virtual void SetFontInformation(const string16& omnibox_font_name, | 27 virtual void SetFontInformation(const string16& omnibox_font_name, |
samarth
2013/07/02 21:14:15
Can this go?
Jered
2013/07/02 22:03:11
The online ntp is still (erronously I think) using
| |
44 size_t omnibox_font_size) OVERRIDE { | 28 size_t omnibox_font_size) OVERRIDE { |
45 Send(new ChromeViewMsg_SearchBoxFontInformation( | 29 Send(new ChromeViewMsg_SearchBoxFontInformation( |
46 routing_id(), omnibox_font_name, omnibox_font_size)); | 30 routing_id(), omnibox_font_name, omnibox_font_size)); |
47 } | 31 } |
48 | 32 |
49 virtual void SetPromoInformation(bool is_app_launcher_enabled) OVERRIDE { | 33 virtual void SetPromoInformation(bool is_app_launcher_enabled) OVERRIDE { |
50 Send(new ChromeViewMsg_SearchBoxPromoInformation( | 34 Send(new ChromeViewMsg_SearchBoxPromoInformation( |
51 routing_id(), is_app_launcher_enabled)); | 35 routing_id(), is_app_launcher_enabled)); |
52 } | 36 } |
53 | 37 |
54 virtual void SendAutocompleteResults( | |
55 const std::vector<InstantAutocompleteResult>& results) OVERRIDE { | |
56 Send(new ChromeViewMsg_SearchBoxAutocompleteResults(routing_id(), results)); | |
57 } | |
58 | |
59 virtual void UpOrDownKeyPressed(int count) OVERRIDE { | |
60 Send(new ChromeViewMsg_SearchBoxUpOrDownKeyPressed(routing_id(), count)); | |
61 } | |
62 | |
63 virtual void EscKeyPressed() OVERRIDE { | |
64 Send(new ChromeViewMsg_SearchBoxEscKeyPressed(routing_id())); | |
65 } | |
66 | |
67 virtual void CancelSelection(const string16& user_text, | |
68 size_t selection_start, | |
69 size_t selection_end, | |
70 bool verbatim) OVERRIDE { | |
71 Send(new ChromeViewMsg_SearchBoxCancelSelection( | |
72 routing_id(), user_text, verbatim, selection_start, selection_end)); | |
73 } | |
74 | |
75 virtual void SendThemeBackgroundInfo( | 38 virtual void SendThemeBackgroundInfo( |
76 const ThemeBackgroundInfo& theme_info) OVERRIDE { | 39 const ThemeBackgroundInfo& theme_info) OVERRIDE { |
77 Send(new ChromeViewMsg_SearchBoxThemeChanged(routing_id(), theme_info)); | 40 Send(new ChromeViewMsg_SearchBoxThemeChanged(routing_id(), theme_info)); |
78 } | 41 } |
79 | 42 |
80 virtual void SetDisplayInstantResults(bool display_instant_results) OVERRIDE { | |
samarth
2013/07/02 21:14:15
We should make sure the server isn't relying on th
Jered
2013/07/02 22:03:11
It can't be set, because Instant is disabled, righ
| |
81 Send(new ChromeViewMsg_SearchBoxSetDisplayInstantResults( | |
82 routing_id(), display_instant_results)); | |
83 } | |
84 | |
85 virtual void FocusChanged(OmniboxFocusState state, | 43 virtual void FocusChanged(OmniboxFocusState state, |
86 OmniboxFocusChangeReason reason) OVERRIDE { | 44 OmniboxFocusChangeReason reason) OVERRIDE { |
87 Send(new ChromeViewMsg_SearchBoxFocusChanged(routing_id(), state, reason)); | 45 Send(new ChromeViewMsg_SearchBoxFocusChanged(routing_id(), state, reason)); |
88 } | 46 } |
89 | 47 |
90 virtual void SetInputInProgress(bool input_in_progress) OVERRIDE { | 48 virtual void SetInputInProgress(bool input_in_progress) OVERRIDE { |
91 Send(new ChromeViewMsg_SearchBoxSetInputInProgress( | 49 Send(new ChromeViewMsg_SearchBoxSetInputInProgress( |
92 routing_id(), input_in_progress)); | 50 routing_id(), input_in_progress)); |
93 } | 51 } |
94 | 52 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 scoped_ptr<InstantIPCSender> sender( | 89 scoped_ptr<InstantIPCSender> sender( |
132 is_incognito ? | 90 is_incognito ? |
133 static_cast<InstantIPCSender*>(new IncognitoInstantIPCSenderImpl()) : | 91 static_cast<InstantIPCSender*>(new IncognitoInstantIPCSenderImpl()) : |
134 static_cast<InstantIPCSender*>(new InstantIPCSenderImpl())); | 92 static_cast<InstantIPCSender*>(new InstantIPCSenderImpl())); |
135 return sender.Pass(); | 93 return sender.Pass(); |
136 } | 94 } |
137 | 95 |
138 void InstantIPCSender::SetContents(content::WebContents* web_contents) { | 96 void InstantIPCSender::SetContents(content::WebContents* web_contents) { |
139 Observe(web_contents); | 97 Observe(web_contents); |
140 } | 98 } |
OLD | NEW |