Fix implicit access to raw pointer of scoped_refptr.

In following patch https://codereview.chromium.org/1963323004/
scoped_refptr will have the previous flawed "Safe Bool Idiom"
implementation removed.

This feature was incorrectly used throughout the codebase
with code implicitly accessing the raw pointer from
scoped_refptr instances. A correct "Safe Bool Idiom" would
have prevented that, but the point is moot as we can now
move to Cxx11 "explicit operator bool()".

Usage has been corrected in two ways:
+ Logic tests no longer compare pointer values, but use a
  boolean expression (typically just the variable name).
+ Casts to boolean types are now explicit with stati_cast<bool>().

BUG=610048
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review-Url: https://codereview.chromium.org/1958823002
Cr-Commit-Position: refs/heads/master@{#393125}
diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc
index d2b697f..e20ec79 100644
--- a/chrome/browser/banners/app_banner_manager.cc
+++ b/chrome/browser/banners/app_banner_manager.cc
@@ -60,7 +60,7 @@
 }
 
 bool AppBannerManager::IsFetcherActive() {
-  return data_fetcher_ != nullptr && data_fetcher_->is_active();
+  return data_fetcher_ && data_fetcher_->is_active();
 }
 
 void AppBannerManager::DidNavigateMainFrame(
@@ -116,7 +116,7 @@
 }
 
 void AppBannerManager::CancelActiveFetcher() {
-  if (data_fetcher_ != nullptr) {
+  if (data_fetcher_) {
     data_fetcher_->Cancel();
     data_fetcher_ = nullptr;
   }
diff --git a/chrome/browser/chromeos/certificate_provider/certificate_provider_service_unittest.cc b/chrome/browser/chromeos/certificate_provider/certificate_provider_service_unittest.cc
index 594a0fe..d17ef8e 100644
--- a/chrome/browser/chromeos/certificate_provider/certificate_provider_service_unittest.cc
+++ b/chrome/browser/chromeos/certificate_provider/certificate_provider_service_unittest.cc
@@ -52,8 +52,7 @@
   certificate_provider::CertificateInfo cert_info;
   cert_info.certificate =
       net::ImportCertFromFile(net::GetTestCertsDirectory(), cert_filename);
-  EXPECT_NE(nullptr, cert_info.certificate) << "Could not load "
-                                            << cert_filename;
+  EXPECT_TRUE(cert_info.certificate) << "Could not load " << cert_filename;
   cert_info.type = net::SSLPrivateKey::Type::RSA;
   cert_info.supported_hashes.push_back(net::SSLPrivateKey::Hash::SHA256);
   cert_info.max_signature_length_in_bytes = 123;
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 8279251d..092dab23 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -568,7 +568,8 @@
                            ? chrome::kThemePackMaterialDesignFilename
                            : chrome::kThemePackFilename);
     SwapThemeSupplier(BrowserThemePack::BuildFromDataPack(path, current_id));
-    loaded_pack = theme_supplier_ != nullptr;
+    if (theme_supplier_)
+      loaded_pack = true;
   }
 
   if (loaded_pack) {
diff --git a/chrome/browser/ui/views/certificate_selector_browsertest.cc b/chrome/browser/ui/views/certificate_selector_browsertest.cc
index 5824ccc..be8d611 100644
--- a/chrome/browser/ui/views/certificate_selector_browsertest.cc
+++ b/chrome/browser/ui/views/certificate_selector_browsertest.cc
@@ -74,11 +74,11 @@
   void SetUpInProcessBrowserTestFixture() override {
     client_1_ =
         net::ImportCertFromFile(net::GetTestCertsDirectory(), "client_1.pem");
-    ASSERT_NE(nullptr, client_1_);
+    ASSERT_TRUE(client_1_);
 
     client_2_ =
         net::ImportCertFromFile(net::GetTestCertsDirectory(), "client_2.pem");
-    ASSERT_NE(nullptr, client_2_);
+    ASSERT_TRUE(client_2_);
   }
 
   void SetUpOnMainThread() override {
diff --git a/chrome/browser/ui/webui/options/password_manager_handler.cc b/chrome/browser/ui/webui/options/password_manager_handler.cc
index c55d106..97e1f611 100644
--- a/chrome/browser/ui/webui/options/password_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/password_manager_handler.cc
@@ -374,7 +374,7 @@
     }
   }
   UMA_HISTOGRAM_BOOLEAN("PasswordManager.StorePasswordImportedFromCSVResult",
-                        store);
+                        static_cast<bool>(store));
 }
 
 void PasswordManagerHandler::HandlePasswordExport(const base::ListValue* args) {