OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/android/tab_model/tab_model.h" | 5 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search_engines/search_terms_data.h" |
10 #include "chrome/browser/sync/glue/synced_window_delegate_android.h" | 11 #include "chrome/browser/sync/glue/synced_window_delegate_android.h" |
11 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 12 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
12 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
13 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
14 | 15 |
15 using content::NotificationService; | 16 using content::NotificationService; |
16 | 17 |
17 TabModel::TabModel(Profile* profile) | 18 TabModel::TabModel(Profile* profile) |
18 : profile_(profile), | 19 : profile_(profile), |
19 synced_window_delegate_( | 20 synced_window_delegate_( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 86 } |
86 | 87 |
87 ToolbarModel* TabModel::GetToolbarModel() { | 88 ToolbarModel* TabModel::GetToolbarModel() { |
88 return toolbar_model_.get(); | 89 return toolbar_model_.get(); |
89 } | 90 } |
90 | 91 |
91 ToolbarModel::SecurityLevel TabModel::GetSecurityLevelForCurrentTab() { | 92 ToolbarModel::SecurityLevel TabModel::GetSecurityLevelForCurrentTab() { |
92 return toolbar_model_->GetSecurityLevel(); | 93 return toolbar_model_->GetSecurityLevel(); |
93 } | 94 } |
94 | 95 |
| 96 string16 TabModel::GetSearchTermsForCurrentTab() { |
| 97 return toolbar_model_->GetText(true); |
| 98 } |
| 99 |
| 100 std::string TabModel::GetQueryExtractionParam() { |
| 101 if (!profile_) |
| 102 return std::string(); |
| 103 UIThreadSearchTermsData search_terms_data(profile_); |
| 104 return search_terms_data.InstantExtendedEnabledParam(); |
| 105 } |
| 106 |
95 void TabModel::Observe( | 107 void TabModel::Observe( |
96 int type, | 108 int type, |
97 const content::NotificationSource& source, | 109 const content::NotificationSource& source, |
98 const content::NotificationDetails& details) { | 110 const content::NotificationDetails& details) { |
99 switch (type) { | 111 switch (type) { |
100 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 112 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
101 // Our profile just got destroyed, so we delete our pointer to it. | 113 // Our profile just got destroyed, so we delete our pointer to it. |
102 profile_ = NULL; | 114 profile_ = NULL; |
103 break; | 115 break; |
104 default: | 116 default: |
105 NOTREACHED(); | 117 NOTREACHED(); |
106 } | 118 } |
107 } | 119 } |
OLD | NEW |