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 <cstdio> | 5 #include <cstdio> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 virtual void WidgetRestored() OVERRIDE { widgets_++; } | 519 virtual void WidgetRestored() OVERRIDE { widgets_++; } |
520 virtual void WidgetHidden() OVERRIDE { widgets_--; } | 520 virtual void WidgetHidden() OVERRIDE { widgets_--; } |
521 virtual int VisibleWidgetCount() const OVERRIDE { return widgets_; } | 521 virtual int VisibleWidgetCount() const OVERRIDE { return widgets_; } |
522 | 522 |
523 virtual bool Send(IPC::Message* msg) OVERRIDE { | 523 virtual bool Send(IPC::Message* msg) OVERRIDE { |
524 VisitCountingProfile* counting_profile = | 524 VisitCountingProfile* counting_profile = |
525 static_cast<VisitCountingProfile*>( | 525 static_cast<VisitCountingProfile*>( |
526 Profile::FromBrowserContext(GetBrowserContext())); | 526 Profile::FromBrowserContext(GetBrowserContext())); |
527 | 527 |
528 if (msg->type() == ChromeViewMsg_VisitedLink_Add::ID) { | 528 if (msg->type() == ChromeViewMsg_VisitedLink_Add::ID) { |
529 void* iter = NULL; | 529 PickleIterator iter(*msg); |
530 std::vector<uint64> fingerprints; | 530 std::vector<uint64> fingerprints; |
531 CHECK(IPC::ReadParam(msg, &iter, &fingerprints)); | 531 CHECK(IPC::ReadParam(msg, &iter, &fingerprints)); |
532 counting_profile->CountAddEvent(fingerprints.size()); | 532 counting_profile->CountAddEvent(fingerprints.size()); |
533 } else if (msg->type() == ChromeViewMsg_VisitedLink_Reset::ID) { | 533 } else if (msg->type() == ChromeViewMsg_VisitedLink_Reset::ID) { |
534 counting_profile->CountResetEvent(); | 534 counting_profile->CountResetEvent(); |
535 } | 535 } |
536 | 536 |
537 delete msg; | 537 delete msg; |
538 return true; | 538 return true; |
539 } | 539 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 EXPECT_EQ(1, profile()->add_event_count()); | 709 EXPECT_EQ(1, profile()->add_event_count()); |
710 EXPECT_EQ(0, profile()->reset_event_count()); | 710 EXPECT_EQ(0, profile()->reset_event_count()); |
711 | 711 |
712 // Activate the tab. | 712 // Activate the tab. |
713 rvh()->WasRestored(); | 713 rvh()->WasRestored(); |
714 | 714 |
715 // We should have only one more reset event. | 715 // We should have only one more reset event. |
716 EXPECT_EQ(1, profile()->add_event_count()); | 716 EXPECT_EQ(1, profile()->add_event_count()); |
717 EXPECT_EQ(1, profile()->reset_event_count()); | 717 EXPECT_EQ(1, profile()->reset_event_count()); |
718 } | 718 } |
OLD | NEW |