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/browser/ui/browser_instant_controller.h" | 5 #include "chrome/browser/ui/browser_instant_controller.h" |
6 | 6 |
7 #include "chrome/browser/browser_shutdown.h" | 7 #include "chrome/browser/browser_shutdown.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_tabstrip.h" | 12 #include "chrome/browser/ui/browser_tabstrip.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/omnibox/location_bar.h" | 14 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 15 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
15 #include "chrome/browser/ui/search/search.h" | 16 #include "chrome/browser/ui/search/search.h" |
16 #include "chrome/browser/ui/search/search_model.h" | 17 #include "chrome/browser/ui/search/search_model.h" |
17 #include "chrome/browser/ui/search/search_tab_helper.h" | 18 #include "chrome/browser/ui/search/search_tab_helper.h" |
18 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
20 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 21 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
21 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
23 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 gfx::Rect BrowserInstantController::GetInstantBounds() { | 105 gfx::Rect BrowserInstantController::GetInstantBounds() { |
105 return browser_->window()->GetInstantBounds(); | 106 return browser_->window()->GetInstantBounds(); |
106 } | 107 } |
107 | 108 |
108 void BrowserInstantController::InstantPreviewFocused() { | 109 void BrowserInstantController::InstantPreviewFocused() { |
109 // NOTE: This is only invoked on aura. | 110 // NOTE: This is only invoked on aura. |
110 browser_->window()->WebContentsFocused( | 111 browser_->window()->WebContentsFocused( |
111 instant_.GetPreviewContents()->web_contents()); | 112 instant_.GetPreviewContents()->web_contents()); |
112 } | 113 } |
113 | 114 |
| 115 void BrowserInstantController::SetInvisibleFocus() { |
| 116 if (browser_->window()->GetLocationBar()) |
| 117 browser_->window()->GetLocationBar()->GetLocationEntry()->SetInvisibleFocus(
); |
| 118 } |
| 119 |
114 TabContents* BrowserInstantController::GetActiveTabContents() const { | 120 TabContents* BrowserInstantController::GetActiveTabContents() const { |
115 return browser_->tab_strip_model()->GetActiveTabContents(); | 121 return browser_->tab_strip_model()->GetActiveTabContents(); |
116 } | 122 } |
117 | 123 |
118 void BrowserInstantController::ActiveTabChanged() { | 124 void BrowserInstantController::ActiveTabChanged() { |
119 instant_.ActiveTabChanged(); | 125 instant_.ActiveTabChanged(); |
120 } | 126 } |
121 | 127 |
122 //////////////////////////////////////////////////////////////////////////////// | 128 //////////////////////////////////////////////////////////////////////////////// |
123 // BrowserInstantController, PrefObserver implementation: | 129 // BrowserInstantController, PrefObserver implementation: |
124 | 130 |
125 void BrowserInstantController::OnPreferenceChanged( | 131 void BrowserInstantController::OnPreferenceChanged( |
126 PrefServiceBase* service, | 132 PrefServiceBase* service, |
127 const std::string& pref_name) { | 133 const std::string& pref_name) { |
128 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); | 134 instant_.SetInstantEnabled(IsInstantEnabled(browser_->profile())); |
129 } | 135 } |
130 | 136 |
131 //////////////////////////////////////////////////////////////////////////////// | 137 //////////////////////////////////////////////////////////////////////////////// |
132 // BrowserInstantController, search::SearchModelObserver implementation: | 138 // BrowserInstantController, search::SearchModelObserver implementation: |
133 | 139 |
134 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, | 140 void BrowserInstantController::ModeChanged(const search::Mode& old_mode, |
135 const search::Mode& new_mode) { | 141 const search::Mode& new_mode) { |
136 instant_.SearchModeChanged(old_mode, new_mode); | 142 instant_.SearchModeChanged(old_mode, new_mode); |
137 } | 143 } |
138 | 144 |
139 } // namespace chrome | 145 } // namespace chrome |
OLD | NEW |