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

Unified Diff: extensions/common/extension_icon_set.cc

Issue 448193002: Cleanup: Make ExtensionIconSet::Get return a const std::string& rather than a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/extension_icon_set.h ('k') | extensions/common/manifest_handlers/icons_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/extension_icon_set.cc
diff --git a/extensions/common/extension_icon_set.cc b/extensions/common/extension_icon_set.cc
index 5ca431fe4e016c0bddb26ffc8fe11ccfbb232bbc..65ccff055e486fbff7191e9d467d0772e97f4368 100644
--- a/extensions/common/extension_icon_set.cc
+++ b/extensions/common/extension_icon_set.cc
@@ -5,6 +5,7 @@
#include "extensions/common/extension_icon_set.h"
#include "base/logging.h"
+#include "base/strings/string_util.h"
ExtensionIconSet::ExtensionIconSet() {}
@@ -19,12 +20,12 @@ void ExtensionIconSet::Add(int size, const std::string& path) {
map_[size] = path;
}
-std::string ExtensionIconSet::Get(int size, MatchType match_type) const {
+const std::string& ExtensionIconSet::Get(int size, MatchType match_type) const {
// The searches for MATCH_BIGGER and MATCH_SMALLER below rely on the fact that
// std::map is sorted. This is per the spec, so it should be safe to rely on.
if (match_type == MATCH_EXACTLY) {
IconMap::const_iterator result = map_.find(size);
- return result == map_.end() ? std::string() : result->second;
+ return result == map_.end() ? base::EmptyString() : result->second;
} else if (match_type == MATCH_SMALLER) {
IconMap::const_reverse_iterator result = map_.rend();
for (IconMap::const_reverse_iterator iter = map_.rbegin();
@@ -34,7 +35,7 @@ std::string ExtensionIconSet::Get(int size, MatchType match_type) const {
break;
}
}
- return result == map_.rend() ? std::string() : result->second;
+ return result == map_.rend() ? base::EmptyString() : result->second;
} else {
DCHECK(match_type == MATCH_BIGGER);
IconMap::const_iterator result = map_.end();
@@ -45,7 +46,7 @@ std::string ExtensionIconSet::Get(int size, MatchType match_type) const {
break;
}
}
- return result == map_.end() ? std::string() : result->second;
+ return result == map_.end() ? base::EmptyString() : result->second;
}
}
« no previous file with comments | « extensions/common/extension_icon_set.h ('k') | extensions/common/manifest_handlers/icons_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698