Commit fd1a23e0 authored by Glen Robertson's avatar Glen Robertson Committed by Commit Bot

WebApp:Convert standalone friend == method into class method.

Change-Id: I92b855f231ede21d1263b4147d895864e7961268
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536651
Commit-Queue: Glen Robertson <glenrob@chromium.org>
Auto-Submit: Glen Robertson <glenrob@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827160}
parent 3647bd30
...@@ -378,7 +378,7 @@ bool operator!=(const WebApp::SyncFallbackData& sync_fallback_data1, ...@@ -378,7 +378,7 @@ bool operator!=(const WebApp::SyncFallbackData& sync_fallback_data1,
return !(sync_fallback_data1 == sync_fallback_data2); return !(sync_fallback_data1 == sync_fallback_data2);
} }
bool operator==(const WebApp& app1, const WebApp& app2) { bool WebApp::operator==(const WebApp& other) const {
auto AsTuple = [](const WebApp& app) { auto AsTuple = [](const WebApp& app) {
// Keep in order declared in web_app.h. // Keep in order declared in web_app.h.
return std::tie( return std::tie(
...@@ -420,11 +420,11 @@ bool operator==(const WebApp& app1, const WebApp& app2) { ...@@ -420,11 +420,11 @@ bool operator==(const WebApp& app1, const WebApp& app2) {
// clang-format on // clang-format on
); );
}; };
return AsTuple(app1) == AsTuple(app2); return AsTuple(*this) == AsTuple(other);
} }
bool operator!=(const WebApp& app1, const WebApp& app2) { bool WebApp::operator!=(const WebApp& other) const {
return !(app1 == app2); return !(*this == other);
} }
} // namespace web_app } // namespace web_app
...@@ -212,12 +212,15 @@ class WebApp { ...@@ -212,12 +212,15 @@ class WebApp {
void SetRunOnOsLoginMode(RunOnOsLoginMode mode); void SetRunOnOsLoginMode(RunOnOsLoginMode mode);
void SetSyncFallbackData(SyncFallbackData sync_fallback_data); void SetSyncFallbackData(SyncFallbackData sync_fallback_data);
// For logging and debug purposes.
bool operator==(const WebApp&) const;
bool operator!=(const WebApp&) const;
private: private:
using Sources = std::bitset<Source::kMaxValue + 1>; using Sources = std::bitset<Source::kMaxValue + 1>;
bool HasAnySpecifiedSourcesAndNoOtherSources(Sources specified_sources) const; bool HasAnySpecifiedSourcesAndNoOtherSources(Sources specified_sources) const;
friend class WebAppDatabase; friend class WebAppDatabase;
friend bool operator==(const WebApp&, const WebApp&);
friend std::ostream& operator<<(std::ostream&, const WebApp&); friend std::ostream& operator<<(std::ostream&, const WebApp&);
AppId app_id_; AppId app_id_;
...@@ -272,9 +275,6 @@ bool operator==(const WebApp::SyncFallbackData& sync_fallback_data1, ...@@ -272,9 +275,6 @@ bool operator==(const WebApp::SyncFallbackData& sync_fallback_data1,
bool operator!=(const WebApp::SyncFallbackData& sync_fallback_data1, bool operator!=(const WebApp::SyncFallbackData& sync_fallback_data1,
const WebApp::SyncFallbackData& sync_fallback_data2); const WebApp::SyncFallbackData& sync_fallback_data2);
bool operator==(const WebApp& app1, const WebApp& app2);
bool operator!=(const WebApp& app1, const WebApp& app2);
} // namespace web_app } // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_
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