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

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

Issue 2817593004: [DevTools] Move eye dropper functionality from protocol to embedder (Closed)
Patch Set: rebased Created 3 years, 8 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 | « chrome/browser/devtools/devtools_window.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_window.cc
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc
index 14aefab9a43aea0e4671864c39c00f3b271cc386..94d7954867a56e1507650596e98f016cab6262c5 100644
--- a/chrome/browser/devtools/devtools_window.cc
+++ b/chrome/browser/devtools/devtools_window.cc
@@ -17,6 +17,7 @@
#include "base/values.h"
#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/data_use_measurement/data_use_web_contents_observer.h"
+#include "chrome/browser/devtools/devtools_eye_dropper.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -1245,6 +1246,29 @@ void DevToolsWindow::SetWhitelistedShortcuts(
event_forwarder_->SetWhitelistedShortcuts(message);
}
+void DevToolsWindow::SetEyeDropperActive(bool active) {
+ WebContents* web_contents = GetInspectedWebContents();
+ if (!web_contents)
+ return;
+ if (active) {
+ eye_dropper_.reset(new DevToolsEyeDropper(
+ web_contents, base::Bind(&DevToolsWindow::ColorPickedInEyeDropper,
+ base::Unretained(this))));
+ } else {
+ eye_dropper_.reset();
+ }
+}
+
+void DevToolsWindow::ColorPickedInEyeDropper(int r, int g, int b, int a) {
+ base::DictionaryValue color;
+ color.SetInteger("r", r);
+ color.SetInteger("g", g);
+ color.SetInteger("b", b);
+ color.SetInteger("a", a);
+ bindings_->CallClientFunction("DevToolsAPI.eyeDropperPickedColor", &color,
+ nullptr, nullptr);
+}
+
void DevToolsWindow::InspectedContentsClosing() {
if (!close_on_detach_)
return;
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698