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

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 b3449b0cdafa2878a7666b5a0a159ac21a26e963..903a8f7c43fff71e2d0120f76fa83231c7a385fe 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,
pfeldman 2014/01/31 11:28:30 I'd rather define traits for Insets and Size
dgozman 2014/01/31 13:33:13 Done.
+ DevToolsContentsResizingStrategy& strategy) {
+ const base::DictionaryValue* dict;
+ if (!list.GetDictionary(pos, &dict))
+ return false;
+ const base::DictionaryValue* insets;
+ if (!dict->GetDictionary("insets", &insets))
+ return false;
+ int top = 0;
+ int left = 0;
+ int bottom = 0;
+ int right = 0;
+ if (!insets->GetInteger("top", &top) ||
+ !insets->GetInteger("left", &left) ||
+ !insets->GetInteger("bottom", &bottom) ||
+ !insets->GetInteger("right", &right))
+ return false;
+ strategy.insets.Set(top, left, bottom, right);
+ const base::DictionaryValue* min_size;
+ if (!dict->GetDictionary("min_size", &min_size))
+ return false;
+ int width = 0;
+ int height = 0;
+ if (!min_size->GetInteger("width", &width) ||
+ !min_size->GetInteger("height", &height))
+ return false;
+ strategy.min_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("moveWindowBy",
BindToListParser(base::Bind(&Delegate::MoveWindow,
base::Unretained(delegate))));

Powered by Google App Engine
This is Rietveld 408576698