OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webdata/web_intents_table.h" | 5 #include "chrome/browser/webdata/web_intents_table.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "sql/statement.h" | 10 #include "sql/statement.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 "WHERE action=?")); | 78 "WHERE action=?")); |
79 if (!s) { | 79 if (!s) { |
80 NOTREACHED() << "Statement prepare failed"; | 80 NOTREACHED() << "Statement prepare failed"; |
81 return false; | 81 return false; |
82 } | 82 } |
83 | 83 |
84 s.BindString16(0, action); | 84 s.BindString16(0, action); |
85 return ExtractIntents(&s, intents); | 85 return ExtractIntents(&s, intents); |
86 } | 86 } |
87 | 87 |
| 88 bool WebIntentsTable::GetWebIntentsForURL( |
| 89 const string16& action, |
| 90 const string16& service_url, |
| 91 std::vector<WebIntentServiceData>* intents) { |
| 92 DCHECK(intents); |
| 93 sql::Statement s(db_->GetUniqueStatement( |
| 94 "SELECT service_url, action, type, title, disposition FROM web_intents " |
| 95 "WHERE action=? AND service_url=?")); |
| 96 if (!s) { |
| 97 NOTREACHED() << "Statement prepare failed"; |
| 98 return false; |
| 99 } |
| 100 |
| 101 s.BindString16(0, action); |
| 102 s.BindString16(1, service_url); |
| 103 return ExtractIntents(&s, intents); |
| 104 } |
| 105 |
88 bool WebIntentsTable::GetAllWebIntents( | 106 bool WebIntentsTable::GetAllWebIntents( |
89 std::vector<WebIntentServiceData>* intents) { | 107 std::vector<WebIntentServiceData>* intents) { |
90 DCHECK(intents); | 108 DCHECK(intents); |
91 sql::Statement s(db_->GetUniqueStatement( | 109 sql::Statement s(db_->GetUniqueStatement( |
92 "SELECT service_url, action, type, title, disposition FROM web_intents")); | 110 "SELECT service_url, action, type, title, disposition FROM web_intents")); |
93 if (!s) { | 111 if (!s) { |
94 NOTREACHED() << "Statement prepare failed"; | 112 NOTREACHED() << "Statement prepare failed"; |
95 return false; | 113 return false; |
96 } | 114 } |
97 | 115 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (!s) { | 148 if (!s) { |
131 NOTREACHED() << "Statement prepare failed"; | 149 NOTREACHED() << "Statement prepare failed"; |
132 return false; | 150 return false; |
133 } | 151 } |
134 | 152 |
135 s.BindString(0, intent.service_url.spec()); | 153 s.BindString(0, intent.service_url.spec()); |
136 s.BindString16(1, intent.action); | 154 s.BindString16(1, intent.action); |
137 s.BindString16(2, intent.type); | 155 s.BindString16(2, intent.type); |
138 return s.Run(); | 156 return s.Run(); |
139 } | 157 } |
OLD | NEW |