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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc

Issue 5682008: Make members of Singleton<T> private and only visible to the singleton type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Implementation of the SafeBrowsingBlockingPage class. 5 // Implementation of the SafeBrowsingBlockingPage class.
6 6
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // The commands returned by the page when the user performs an action. 69 // The commands returned by the page when the user performs an action.
70 static const char* const kShowDiagnosticCommand = "showDiagnostic"; 70 static const char* const kShowDiagnosticCommand = "showDiagnostic";
71 static const char* const kReportErrorCommand = "reportError"; 71 static const char* const kReportErrorCommand = "reportError";
72 static const char* const kLearnMoreCommand = "learnMore"; 72 static const char* const kLearnMoreCommand = "learnMore";
73 static const char* const kProceedCommand = "proceed"; 73 static const char* const kProceedCommand = "proceed";
74 static const char* const kTakeMeBackCommand = "takeMeBack"; 74 static const char* const kTakeMeBackCommand = "takeMeBack";
75 75
76 // static 76 // static
77 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; 77 SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
78 78
79 static base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap>
80 g_unsafe_resource_map(base::LINKER_INITIALIZED);
81
79 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we 82 // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we
80 // don't leak it. 83 // don't leak it.
81 class SafeBrowsingBlockingPageFactoryImpl 84 class SafeBrowsingBlockingPageFactoryImpl
82 : public SafeBrowsingBlockingPageFactory { 85 : public SafeBrowsingBlockingPageFactory {
83 public: 86 public:
84 SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 87 SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
85 SafeBrowsingService* service, 88 SafeBrowsingService* service,
86 TabContents* tab_contents, 89 TabContents* tab_contents,
87 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) { 90 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) {
88 return new SafeBrowsingBlockingPage(service, tab_contents, 91 return new SafeBrowsingBlockingPage(service, tab_contents,
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 BrowserThread::PostTask( 555 BrowserThread::PostTask(
553 BrowserThread::IO, FROM_HERE, 556 BrowserThread::IO, FROM_HERE,
554 NewRunnableMethod( 557 NewRunnableMethod(
555 sb_service, &SafeBrowsingService::OnBlockingPageDone, 558 sb_service, &SafeBrowsingService::OnBlockingPageDone,
556 unsafe_resources, proceed)); 559 unsafe_resources, proceed));
557 } 560 }
558 561
559 // static 562 // static
560 SafeBrowsingBlockingPage::UnsafeResourceMap* 563 SafeBrowsingBlockingPage::UnsafeResourceMap*
561 SafeBrowsingBlockingPage::GetUnsafeResourcesMap() { 564 SafeBrowsingBlockingPage::GetUnsafeResourcesMap() {
562 return Singleton<UnsafeResourceMap>::get(); 565 return g_unsafe_resource_map.Pointer();
563 } 566 }
564 567
565 // static 568 // static
566 void SafeBrowsingBlockingPage::ShowBlockingPage( 569 void SafeBrowsingBlockingPage::ShowBlockingPage(
567 SafeBrowsingService* sb_service, 570 SafeBrowsingService* sb_service,
568 const SafeBrowsingService::UnsafeResource& unsafe_resource) { 571 const SafeBrowsingService::UnsafeResource& unsafe_resource) {
569 TabContents* tab_contents = tab_util::GetTabContentsByID( 572 TabContents* tab_contents = tab_util::GetTabContentsByID(
570 unsafe_resource.render_process_host_id, unsafe_resource.render_view_id); 573 unsafe_resource.render_process_host_id, unsafe_resource.render_view_id);
571 574
572 InterstitialPage* interstitial = 575 InterstitialPage* interstitial =
(...skipping 26 matching lines...) Expand all
599 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); 602 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap();
600 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource); 603 (*unsafe_resource_map)[tab_contents].push_back(unsafe_resource);
601 } 604 }
602 605
603 // static 606 // static
604 bool SafeBrowsingBlockingPage::IsMainPage( 607 bool SafeBrowsingBlockingPage::IsMainPage(
605 const UnsafeResourceList& unsafe_resources) { 608 const UnsafeResourceList& unsafe_resources) {
606 return unsafe_resources.size() == 1 && 609 return unsafe_resources.size() == 1 &&
607 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME; 610 unsafe_resources[0].resource_type == ResourceType::MAIN_FRAME;
608 } 611 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698