Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Side by Side Diff: chrome/browser/webdata/web_intents_table.cc

Issue 10914278: Fix for non-sticky defaults bug. Added a bunch of tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to head Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/webdata/web_intents_table.h" 5 #include "chrome/browser/webdata/web_intents_table.h"
6 #include <string> 6 #include <string>
7 7
8 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 return s.Succeeded(); 295 return s.Succeeded();
296 296
297 } 297 }
298 298
299 bool WebIntentsTable::SetDefaultService( 299 bool WebIntentsTable::SetDefaultService(
300 const DefaultWebIntentService& default_service) { 300 const DefaultWebIntentService& default_service) {
301 sql::Statement s(db_->GetUniqueStatement( 301 sql::Statement s(db_->GetUniqueStatement(
302 "INSERT OR REPLACE INTO web_intents_defaults " 302 "INSERT OR REPLACE INTO web_intents_defaults "
303 "(action, type, url_pattern, user_date, suppression, service_url) " 303 "(action, type, url_pattern, user_date, suppression,"
304 "VALUES (?, ?, ?, ?, ?, ?)")); 304 " service_url, scheme) "
305 "VALUES (?, ?, ?, ?, ?, ?, ?)"));
305 s.BindString16(0, default_service.action); 306 s.BindString16(0, default_service.action);
306 s.BindString16(1, default_service.type); 307 s.BindString16(1, default_service.type);
307 s.BindString(2, default_service.url_pattern.GetAsString()); 308 s.BindString(2, default_service.url_pattern.GetAsString());
308 s.BindInt(3, default_service.user_date); 309 s.BindInt(3, default_service.user_date);
309 s.BindInt64(4, default_service.suppression); 310 s.BindInt64(4, default_service.suppression);
310 s.BindString(5, default_service.service_url); 311 s.BindString(5, default_service.service_url);
312 s.BindString16(6, default_service.scheme);
311 313
312 return s.Run(); 314 return s.Run();
313 } 315 }
314 316
315 bool WebIntentsTable::RemoveDefaultService( 317 bool WebIntentsTable::RemoveDefaultService(
316 const DefaultWebIntentService& default_service) { 318 const DefaultWebIntentService& default_service) {
317 sql::Statement s(db_->GetUniqueStatement( 319 sql::Statement s(db_->GetUniqueStatement(
318 "DELETE FROM web_intents_defaults " 320 "DELETE FROM web_intents_defaults "
319 "WHERE action = ? AND type = ? AND url_pattern = ?")); 321 "WHERE action = ? AND type = ? AND url_pattern = ?"));
320 s.BindString16(0, default_service.action); 322 s.BindString16(0, default_service.action);
321 s.BindString16(1, default_service.type); 323 s.BindString16(1, default_service.type);
322 s.BindString(2, default_service.url_pattern.GetAsString()); 324 s.BindString(2, default_service.url_pattern.GetAsString());
323 325
324 return s.Run(); 326 return s.Run();
325 } 327 }
326 328
327 bool WebIntentsTable::RemoveServiceDefaults(const GURL& service_url) { 329 bool WebIntentsTable::RemoveServiceDefaults(const GURL& service_url) {
328 sql::Statement s(db_->GetUniqueStatement( 330 sql::Statement s(db_->GetUniqueStatement(
329 "DELETE FROM web_intents_defaults WHERE service_url = ?")); 331 "DELETE FROM web_intents_defaults WHERE service_url = ?"));
330 s.BindString(0, service_url.spec()); 332 s.BindString(0, service_url.spec());
331 333
332 return s.Run(); 334 return s.Run();
333 } 335 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service_unittest.cc ('k') | chrome/browser/webdata/web_intents_table_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698