Commit c63fdd71 authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Move browsing_data_cookies_util functions into namespace

The style guide says that static functions shouldn't be in the global
namespace.

TBR: dschuyler@chromium.org, dtrainor@chromium.org
Change-Id: I48230748abf496eb312ad0901bf88cbbf9307bcc
Reviewed-on: https://chromium-review.googlesource.com/c/1299233
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarMartin Šrámek <msramek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603043}
parent 3260e833
...@@ -66,12 +66,12 @@ void BrowsingDataCounterBridge::Destroy(JNIEnv* env, ...@@ -66,12 +66,12 @@ void BrowsingDataCounterBridge::Destroy(JNIEnv* env,
void BrowsingDataCounterBridge::onCounterFinished( void BrowsingDataCounterBridge::onCounterFinished(
std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) {
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
Profile* profile =
ProfileManager::GetActiveUserProfile()->GetOriginalProfile();
ScopedJavaLocalRef<jstring> result_string = ScopedJavaLocalRef<jstring> result_string =
base::android::ConvertUTF16ToJavaString( base::android::ConvertUTF16ToJavaString(
env, env, browsing_data_counter_utils::GetChromeCounterTextFromResult(
GetChromeCounterTextFromResult( result.get(), profile));
result.get(),
ProfileManager::GetActiveUserProfile()->GetOriginalProfile()));
Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished(env, jobject_, Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished(env, jobject_,
result_string); result_string);
} }
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
#include "chrome/browser/sync/sync_ui_util.h" #include "chrome/browser/sync/sync_ui_util.h"
#endif #endif
namespace browsing_data_counter_utils {
namespace {
// A helper function to display the size of cache in units of MB or higher. // A helper function to display the size of cache in units of MB or higher.
// We need this, as 1 MB is the lowest nonzero cache size displayed by the // We need this, as 1 MB is the lowest nonzero cache size displayed by the
// counter. // counter.
...@@ -44,6 +47,7 @@ base::string16 FormatBytesMBOrHigher( ...@@ -44,6 +47,7 @@ base::string16 FormatBytesMBOrHigher(
return ui::FormatBytesWithUnits( return ui::FormatBytesWithUnits(
bytes, ui::DataUnits::DATA_UNITS_MEBIBYTE, true); bytes, ui::DataUnits::DATA_UNITS_MEBIBYTE, true);
} }
} // namespace
bool ShouldShowCookieException(Profile* profile) { bool ShouldShowCookieException(Profile* profile) {
if (AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile)) { if (AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile)) {
...@@ -232,3 +236,5 @@ base::string16 GetChromeCounterTextFromResult( ...@@ -232,3 +236,5 @@ base::string16 GetChromeCounterTextFromResult(
return browsing_data::GetCounterTextFromResult(result); return browsing_data::GetCounterTextFromResult(result);
} }
} // namespace browsing_data_counter_utils
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
class Profile; class Profile;
namespace browsing_data_counter_utils {
// Whether the exception about not being signed out of your Google profile // Whether the exception about not being signed out of your Google profile
// should be shown. // should be shown.
bool ShouldShowCookieException(Profile* profile); bool ShouldShowCookieException(Profile* profile);
...@@ -20,4 +22,6 @@ base::string16 GetChromeCounterTextFromResult( ...@@ -20,4 +22,6 @@ base::string16 GetChromeCounterTextFromResult(
const browsing_data::BrowsingDataCounter::Result* result, const browsing_data::BrowsingDataCounter::Result* result,
Profile* profile); Profile* profile);
} // namespace browsing_data_counter_utils
#endif // CHROME_BROWSER_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_UTILS_H_ #endif // CHROME_BROWSER_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_UTILS_H_
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "components/signin/core/browser/signin_manager_base.h" #include "components/signin/core/browser/signin_manager_base.h"
#endif #endif
namespace { namespace browsing_data_counter_utils {
class BrowsingDataCounterUtilsBrowserTest class BrowsingDataCounterUtilsBrowserTest
: public SyncTest, : public SyncTest,
...@@ -123,4 +123,4 @@ IN_PROC_BROWSER_TEST_P(BrowsingDataCounterUtilsBrowserTest, ...@@ -123,4 +123,4 @@ IN_PROC_BROWSER_TEST_P(BrowsingDataCounterUtilsBrowserTest,
#endif // !defined(OS_CHROMEOS) #endif // !defined(OS_CHROMEOS)
} }
} // namespace } // namespace browsing_data_counter_utils
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include "chrome/browser/browsing_data/counters/media_licenses_counter.h" #include "chrome/browser/browsing_data/counters/media_licenses_counter.h"
#endif #endif
namespace browsing_data_counter_utils {
class BrowsingDataCounterUtilsTest : public testing::Test { class BrowsingDataCounterUtilsTest : public testing::Test {
public: public:
BrowsingDataCounterUtilsTest() {} BrowsingDataCounterUtilsTest() {}
...@@ -221,3 +223,5 @@ TEST_F(BrowsingDataCounterUtilsTest, DeletePasswordsAndSigninData) { ...@@ -221,3 +223,5 @@ TEST_F(BrowsingDataCounterUtilsTest, DeletePasswordsAndSigninData) {
password_store->ShutdownOnUIThread(); password_store->ShutdownOnUIThread();
} }
} // namespace browsing_data_counter_utils
...@@ -15,7 +15,7 @@ using content::BrowserThread; ...@@ -15,7 +15,7 @@ using content::BrowserThread;
namespace { namespace {
bool CheckSyncState(Profile* profile, const syncer::SyncService* sync_service) { bool CheckSyncState(Profile* profile, const syncer::SyncService* sync_service) {
return ShouldShowCookieException(profile); return browsing_data_counter_utils::ShouldShowCookieException(profile);
} }
} // namespace } // namespace
......
...@@ -351,7 +351,8 @@ void ClearBrowsingDataHandler::UpdateSyncState() { ...@@ -351,7 +351,8 @@ void ClearBrowsingDataHandler::UpdateSyncState() {
base::Value(sync_service_ && sync_service_->IsSyncFeatureActive() && base::Value(sync_service_ && sync_service_->IsSyncFeatureActive() &&
sync_service_->GetActiveDataTypes().Has( sync_service_->GetActiveDataTypes().Has(
syncer::HISTORY_DELETE_DIRECTIVES)), syncer::HISTORY_DELETE_DIRECTIVES)),
base::Value(ShouldShowCookieException(profile_))); base::Value(
browsing_data_counter_utils::ShouldShowCookieException(profile_)));
} }
void ClearBrowsingDataHandler::RefreshHistoryNotice() { void ClearBrowsingDataHandler::RefreshHistoryNotice() {
...@@ -391,7 +392,8 @@ void ClearBrowsingDataHandler::UpdateCounterText( ...@@ -391,7 +392,8 @@ void ClearBrowsingDataHandler::UpdateCounterText(
CallJavascriptFunction( CallJavascriptFunction(
"cr.webUIListenerCallback", base::Value("update-counter-text"), "cr.webUIListenerCallback", base::Value("update-counter-text"),
base::Value(result->source()->GetPrefName()), base::Value(result->source()->GetPrefName()),
base::Value(GetChromeCounterTextFromResult(result.get(), profile_))); base::Value(browsing_data_counter_utils::GetChromeCounterTextFromResult(
result.get(), profile_)));
} }
void ClearBrowsingDataHandler::HandleTimePeriodChanged( void ClearBrowsingDataHandler::HandleTimePeriodChanged(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment