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

Unified Diff: chrome/browser/devtools/devtools_embedder_message_dispatcher.cc

Issue 137483007: [DevTools] Use special resizing strategy instead of insets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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
Index: chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
diff --git a/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc b/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
index 9cf39ef75b261e1e089b449a7fd19cd06ad8ea0b..21d34647b63bea653bed8e184e5552cb355d18aa 100644
--- a/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
+++ b/chrome/browser/devtools/devtools_embedder_message_dispatcher.cc
@@ -21,6 +21,36 @@ bool GetValue(const base::ListValue& list, int pos, bool& value) {
return list.GetBoolean(pos, &value);
}
+bool GetValue(const base::ListValue& list, int pos, gfx::Insets& insets) {
+ const base::DictionaryValue* dict;
+ if (!list.GetDictionary(pos, &dict))
+ return false;
+ int top = 0;
+ int left = 0;
+ int bottom = 0;
+ int right = 0;
+ if (!dict->GetInteger("top", &top) ||
+ !dict->GetInteger("left", &left) ||
+ !dict->GetInteger("bottom", &bottom) ||
+ !dict->GetInteger("right", &right))
+ return false;
+ insets.Set(top, left, bottom, right);
+ return true;
+}
+
+bool GetValue(const base::ListValue& list, int pos, gfx::Size& size) {
+ const base::DictionaryValue* dict;
+ if (!list.GetDictionary(pos, &dict))
+ return false;
+ int width = 0;
+ int height = 0;
+ if (!dict->GetInteger("width", &width) ||
+ !dict->GetInteger("height", &height))
+ return false;
+ size.SetSize(width, height);
+ return true;
+}
+
template <typename T>
struct StorageTraits {
typedef T StorageType;
@@ -161,6 +191,9 @@ DevToolsEmbedderMessageDispatcher::DevToolsEmbedderMessageDispatcher(
RegisterHandler("setContentsInsets",
BindToListParser(base::Bind(&Delegate::SetContentsInsets,
base::Unretained(delegate))));
+ RegisterHandler("setContentsResizingStrategy",
+ BindToListParser(base::Bind(&Delegate::SetContentsResizingStrategy,
+ base::Unretained(delegate))));
RegisterHandler("inspectElementCompleted",
BindToListParser(base::Bind(&Delegate::InspectElementCompleted,
base::Unretained(delegate))));

Powered by Google App Engine
This is Rietveld 408576698