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,
void BrowsingDataCounterBridge::onCounterFinished(
std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) {
JNIEnv* env = base::android::AttachCurrentThread();
Profile* profile =
ProfileManager::GetActiveUserProfile()->GetOriginalProfile();
ScopedJavaLocalRef<jstring> result_string =
base::android::ConvertUTF16ToJavaString(
env,
GetChromeCounterTextFromResult(
result.get(),
ProfileManager::GetActiveUserProfile()->GetOriginalProfile()));
env, browsing_data_counter_utils::GetChromeCounterTextFromResult(
result.get(), profile));
Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished(env, jobject_,
result_string);
}
......
......@@ -33,6 +33,9 @@
#include "chrome/browser/sync/sync_ui_util.h"
#endif
namespace browsing_data_counter_utils {
namespace {
// 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
// counter.
......@@ -44,6 +47,7 @@ base::string16 FormatBytesMBOrHigher(
return ui::FormatBytesWithUnits(
bytes, ui::DataUnits::DATA_UNITS_MEBIBYTE, true);
}
} // namespace
bool ShouldShowCookieException(Profile* profile) {
if (AccountConsistencyModeManager::IsMirrorEnabledForProfile(profile)) {
......@@ -232,3 +236,5 @@ base::string16 GetChromeCounterTextFromResult(
return browsing_data::GetCounterTextFromResult(result);
}
} // namespace browsing_data_counter_utils
......@@ -11,6 +11,8 @@
class Profile;
namespace browsing_data_counter_utils {
// Whether the exception about not being signed out of your Google profile
// should be shown.
bool ShouldShowCookieException(Profile* profile);
......@@ -20,4 +22,6 @@ base::string16 GetChromeCounterTextFromResult(
const browsing_data::BrowsingDataCounter::Result* result,
Profile* profile);
} // namespace browsing_data_counter_utils
#endif // CHROME_BROWSER_BROWSING_DATA_COUNTERS_BROWSING_DATA_COUNTER_UTILS_H_
......@@ -26,7 +26,7 @@
#include "components/signin/core/browser/signin_manager_base.h"
#endif
namespace {
namespace browsing_data_counter_utils {
class BrowsingDataCounterUtilsBrowserTest
: public SyncTest,
......@@ -123,4 +123,4 @@ IN_PROC_BROWSER_TEST_P(BrowsingDataCounterUtilsBrowserTest,
#endif // !defined(OS_CHROMEOS)
}
} // namespace
} // namespace browsing_data_counter_utils
......@@ -30,6 +30,8 @@
#include "chrome/browser/browsing_data/counters/media_licenses_counter.h"
#endif
namespace browsing_data_counter_utils {
class BrowsingDataCounterUtilsTest : public testing::Test {
public:
BrowsingDataCounterUtilsTest() {}
......@@ -221,3 +223,5 @@ TEST_F(BrowsingDataCounterUtilsTest, DeletePasswordsAndSigninData) {
password_store->ShutdownOnUIThread();
}
} // namespace browsing_data_counter_utils
......@@ -15,7 +15,7 @@ using content::BrowserThread;
namespace {
bool CheckSyncState(Profile* profile, const syncer::SyncService* sync_service) {
return ShouldShowCookieException(profile);
return browsing_data_counter_utils::ShouldShowCookieException(profile);
}
} // namespace
......
......@@ -351,7 +351,8 @@ void ClearBrowsingDataHandler::UpdateSyncState() {
base::Value(sync_service_ && sync_service_->IsSyncFeatureActive() &&
sync_service_->GetActiveDataTypes().Has(
syncer::HISTORY_DELETE_DIRECTIVES)),
base::Value(ShouldShowCookieException(profile_)));
base::Value(
browsing_data_counter_utils::ShouldShowCookieException(profile_)));
}
void ClearBrowsingDataHandler::RefreshHistoryNotice() {
......@@ -391,7 +392,8 @@ void ClearBrowsingDataHandler::UpdateCounterText(
CallJavascriptFunction(
"cr.webUIListenerCallback", base::Value("update-counter-text"),
base::Value(result->source()->GetPrefName()),
base::Value(GetChromeCounterTextFromResult(result.get(), profile_)));
base::Value(browsing_data_counter_utils::GetChromeCounterTextFromResult(
result.get(), profile_)));
}
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