| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/task/cancelable_task_tracker.h" | 10 #include "base/task/cancelable_task_tracker.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 void QuitCallback() { | 274 void QuitCallback() { |
| 275 base::MessageLoop::current()->Quit(); | 275 base::MessageLoop::current()->Quit(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Adds a page to history. | 278 // Adds a page to history. |
| 279 void AddPageToHistory(const GURL& url) { | 279 void AddPageToHistory(const GURL& url) { |
| 280 RedirectList redirects; | 280 RedirectList redirects; |
| 281 redirects.push_back(url); | 281 redirects.push_back(url); |
| 282 history_service()->AddPage( | 282 history_service()->AddPage( |
| 283 url, base::Time::Now(), reinterpret_cast<ContextID>(1), 0, GURL(), | 283 url, base::Time::Now(), reinterpret_cast<ContextID>(1), 0, GURL(), |
| 284 redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, | 284 redirects, ui::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, |
| 285 false); | 285 false); |
| 286 } | 286 } |
| 287 | 287 |
| 288 // Adds a page to history. | 288 // Adds a page to history. |
| 289 void AddPageToHistory(const GURL& url, const base::string16& title) { | 289 void AddPageToHistory(const GURL& url, const base::string16& title) { |
| 290 RedirectList redirects; | 290 RedirectList redirects; |
| 291 redirects.push_back(url); | 291 redirects.push_back(url); |
| 292 history_service()->AddPage( | 292 history_service()->AddPage( |
| 293 url, base::Time::Now(), reinterpret_cast<ContextID>(1), 0, GURL(), | 293 url, base::Time::Now(), reinterpret_cast<ContextID>(1), 0, GURL(), |
| 294 redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, | 294 redirects, ui::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, |
| 295 false); | 295 false); |
| 296 history_service()->SetPageTitle(url, title); | 296 history_service()->SetPageTitle(url, title); |
| 297 } | 297 } |
| 298 | 298 |
| 299 // Adds a page to history. | 299 // Adds a page to history. |
| 300 void AddPageToHistory(const GURL& url, | 300 void AddPageToHistory(const GURL& url, |
| 301 const base::string16& title, | 301 const base::string16& title, |
| 302 const history::RedirectList& redirects, | 302 const history::RedirectList& redirects, |
| 303 base::Time time) { | 303 base::Time time) { |
| 304 history_service()->AddPage( | 304 history_service()->AddPage( |
| 305 url, time, reinterpret_cast<ContextID>(1), 0, GURL(), | 305 url, time, reinterpret_cast<ContextID>(1), 0, GURL(), |
| 306 redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, | 306 redirects, ui::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, |
| 307 false); | 307 false); |
| 308 history_service()->SetPageTitle(url, title); | 308 history_service()->SetPageTitle(url, title); |
| 309 } | 309 } |
| 310 | 310 |
| 311 // Delets a url. | 311 // Delets a url. |
| 312 void DeleteURL(const GURL& url) { | 312 void DeleteURL(const GURL& url) { |
| 313 history_service()->DeleteURL(url); | 313 history_service()->DeleteURL(url); |
| 314 } | 314 } |
| 315 | 315 |
| 316 // Returns true if the thumbnail equals the specified bytes. | 316 // Returns true if the thumbnail equals the specified bytes. |
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 ASSERT_EQ(orig_thumbnail.getSize(), thumbnail.getSize()); | 1619 ASSERT_EQ(orig_thumbnail.getSize(), thumbnail.getSize()); |
| 1620 orig_thumbnail.lockPixels(); | 1620 orig_thumbnail.lockPixels(); |
| 1621 thumbnail.lockPixels(); | 1621 thumbnail.lockPixels(); |
| 1622 EXPECT_EQ(0, memcmp(orig_thumbnail.getPixels(), thumbnail.getPixels(), | 1622 EXPECT_EQ(0, memcmp(orig_thumbnail.getPixels(), thumbnail.getPixels(), |
| 1623 orig_thumbnail.getSize())); | 1623 orig_thumbnail.getSize())); |
| 1624 thumbnail.unlockPixels(); | 1624 thumbnail.unlockPixels(); |
| 1625 orig_thumbnail.unlockPixels(); | 1625 orig_thumbnail.unlockPixels(); |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 } // namespace history | 1628 } // namespace history |
| OLD | NEW |