OLD | NEW |
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 #include "chrome/renderer/searchbox/searchbox.h" | 5 #include "chrome/renderer/searchbox/searchbox.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/common/omnibox_focus_state.h" |
11 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
12 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
13 #include "chrome/renderer/searchbox/searchbox_extension.h" | 14 #include "chrome/renderer/searchbox/searchbox_extension.h" |
14 #include "content/public/renderer/render_view.h" | 15 #include "content/public/renderer/render_view.h" |
15 #include "grit/renderer_resources.h" | 16 #include "grit/renderer_resources.h" |
16 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 93 } |
93 | 94 |
94 void SearchBox::ShowInstantOverlay(int height, InstantSizeUnits units) { | 95 void SearchBox::ShowInstantOverlay(int height, InstantSizeUnits units) { |
95 render_view()->Send(new ChromeViewHostMsg_ShowInstantOverlay( | 96 render_view()->Send(new ChromeViewHostMsg_ShowInstantOverlay( |
96 render_view()->GetRoutingID(), render_view()->GetPageId(), height, | 97 render_view()->GetRoutingID(), render_view()->GetPageId(), height, |
97 units)); | 98 units)); |
98 } | 99 } |
99 | 100 |
100 void SearchBox::FocusOmnibox() { | 101 void SearchBox::FocusOmnibox() { |
101 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( | 102 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( |
102 render_view()->GetRoutingID(), render_view()->GetPageId())); | 103 render_view()->GetRoutingID(), render_view()->GetPageId(), |
| 104 OMNIBOX_FOCUS_VISIBLE)); |
103 } | 105 } |
104 | 106 |
105 void SearchBox::StartCapturingKeyStrokes() { | 107 void SearchBox::StartCapturingKeyStrokes() { |
106 render_view()->Send(new ChromeViewHostMsg_StartCapturingKeyStrokes( | 108 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( |
107 render_view()->GetRoutingID(), render_view()->GetPageId())); | 109 render_view()->GetRoutingID(), render_view()->GetPageId(), |
| 110 OMNIBOX_FOCUS_INVISIBLE)); |
108 } | 111 } |
109 | 112 |
110 void SearchBox::StopCapturingKeyStrokes() { | 113 void SearchBox::StopCapturingKeyStrokes() { |
111 render_view()->Send(new ChromeViewHostMsg_StopCapturingKeyStrokes( | 114 render_view()->Send(new ChromeViewHostMsg_FocusOmnibox( |
112 render_view()->GetRoutingID(), render_view()->GetPageId())); | 115 render_view()->GetRoutingID(), render_view()->GetPageId(), |
| 116 OMNIBOX_FOCUS_NONE)); |
113 } | 117 } |
114 | 118 |
115 void SearchBox::NavigateToURL(const GURL& url, | 119 void SearchBox::NavigateToURL(const GURL& url, |
116 content::PageTransition transition, | 120 content::PageTransition transition, |
117 WindowOpenDisposition disposition) { | 121 WindowOpenDisposition disposition) { |
118 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( | 122 render_view()->Send(new ChromeViewHostMsg_SearchBoxNavigate( |
119 render_view()->GetRoutingID(), render_view()->GetPageId(), | 123 render_view()->GetRoutingID(), render_view()->GetPageId(), |
120 url, transition, disposition)); | 124 url, transition, disposition)); |
121 } | 125 } |
122 | 126 |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 std::string trial_flags = | 505 std::string trial_flags = |
502 base::FieldTrialList::FindFullName(kInstantExtendedFieldTrialName); | 506 base::FieldTrialList::FindFullName(kInstantExtendedFieldTrialName); |
503 std::vector<std::string> flags; | 507 std::vector<std::string> flags; |
504 Tokenize(trial_flags, " ", &flags); | 508 Tokenize(trial_flags, " ", &flags); |
505 for (size_t i = 0; i < flags.size(); ++i) { | 509 for (size_t i = 0; i < flags.size(); ++i) { |
506 if (flags[i] == kIframesEnabledFlagWithValue) | 510 if (flags[i] == kIframesEnabledFlagWithValue) |
507 return true; | 511 return true; |
508 } | 512 } |
509 return false; | 513 return false; |
510 } | 514 } |
OLD | NEW |