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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp

Issue 2835843002: Revert of [DevTools] Consolidate overlay-related functionality in Overlay domain (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 namespace blink { 74 namespace blink {
75 75
76 using protocol::Response; 76 using protocol::Response;
77 77
78 namespace PageAgentState { 78 namespace PageAgentState {
79 static const char kPageAgentEnabled[] = "pageAgentEnabled"; 79 static const char kPageAgentEnabled[] = "pageAgentEnabled";
80 static const char kPageAgentScriptsToEvaluateOnLoad[] = 80 static const char kPageAgentScriptsToEvaluateOnLoad[] =
81 "pageAgentScriptsToEvaluateOnLoad"; 81 "pageAgentScriptsToEvaluateOnLoad";
82 static const char kScreencastEnabled[] = "screencastEnabled"; 82 static const char kScreencastEnabled[] = "screencastEnabled";
83 static const char kAutoAttachToCreatedPages[] = "autoAttachToCreatedPages"; 83 static const char kAutoAttachToCreatedPages[] = "autoAttachToCreatedPages";
84 static const char kOverlaySuspended[] = "overlaySuspended";
85 static const char kOverlayMessage[] = "overlayMessage";
84 } 86 }
85 87
86 namespace { 88 namespace {
87 89
88 KURL UrlWithoutFragment(const KURL& url) { 90 KURL UrlWithoutFragment(const KURL& url) {
89 KURL result = url; 91 KURL result = url;
90 result.RemoveFragmentIdentifier(); 92 result.RemoveFragmentIdentifier();
91 return result; 93 return result;
92 } 94 }
93 95
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 last_script_identifier_(0), 369 last_script_identifier_(0),
368 enabled_(false), 370 enabled_(false),
369 reloading_(false), 371 reloading_(false),
370 inspector_resource_content_loader_(resource_content_loader), 372 inspector_resource_content_loader_(resource_content_loader),
371 resource_content_loader_client_id_( 373 resource_content_loader_client_id_(
372 resource_content_loader->CreateClientId()) {} 374 resource_content_loader->CreateClientId()) {}
373 375
374 void InspectorPageAgent::Restore() { 376 void InspectorPageAgent::Restore() {
375 if (state_->booleanProperty(PageAgentState::kPageAgentEnabled, false)) 377 if (state_->booleanProperty(PageAgentState::kPageAgentEnabled, false))
376 enable(); 378 enable();
379 if (client_) {
380 String overlay_message;
381 state_->getString(PageAgentState::kOverlayMessage, &overlay_message);
382 client_->ConfigureOverlay(
383 state_->booleanProperty(PageAgentState::kOverlaySuspended, false),
384 overlay_message);
385 }
377 } 386 }
378 387
379 Response InspectorPageAgent::enable() { 388 Response InspectorPageAgent::enable() {
380 enabled_ = true; 389 enabled_ = true;
381 state_->setBoolean(PageAgentState::kPageAgentEnabled, true); 390 state_->setBoolean(PageAgentState::kPageAgentEnabled, true);
382 instrumenting_agents_->addInspectorPageAgent(this); 391 instrumenting_agents_->addInspectorPageAgent(this);
383 return Response::OK(); 392 return Response::OK();
384 } 393 }
385 394
386 Response InspectorPageAgent::disable() { 395 Response InspectorPageAgent::disable() {
387 enabled_ = false; 396 enabled_ = false;
388 state_->setBoolean(PageAgentState::kPageAgentEnabled, false); 397 state_->setBoolean(PageAgentState::kPageAgentEnabled, false);
389 state_->remove(PageAgentState::kPageAgentScriptsToEvaluateOnLoad); 398 state_->remove(PageAgentState::kPageAgentScriptsToEvaluateOnLoad);
390 script_to_evaluate_on_load_once_ = String(); 399 script_to_evaluate_on_load_once_ = String();
391 pending_script_to_evaluate_on_load_once_ = String(); 400 pending_script_to_evaluate_on_load_once_ = String();
392 instrumenting_agents_->removeInspectorPageAgent(this); 401 instrumenting_agents_->removeInspectorPageAgent(this);
393 inspector_resource_content_loader_->Cancel( 402 inspector_resource_content_loader_->Cancel(
394 resource_content_loader_client_id_); 403 resource_content_loader_client_id_);
395 404
396 stopScreencast(); 405 stopScreencast();
406 configureOverlay(false, String());
397 407
398 FinishReload(); 408 FinishReload();
399 return Response::OK(); 409 return Response::OK();
400 } 410 }
401 411
402 Response InspectorPageAgent::addScriptToEvaluateOnLoad(const String& source, 412 Response InspectorPageAgent::addScriptToEvaluateOnLoad(const String& source,
403 String* identifier) { 413 String* identifier) {
404 protocol::DictionaryValue* scripts = 414 protocol::DictionaryValue* scripts =
405 state_->getObject(PageAgentState::kPageAgentScriptsToEvaluateOnLoad); 415 state_->getObject(PageAgentState::kPageAgentScriptsToEvaluateOnLoad);
406 if (!scripts) { 416 if (!scripts) {
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 Maybe<int> every_nth_frame) { 857 Maybe<int> every_nth_frame) {
848 state_->setBoolean(PageAgentState::kScreencastEnabled, true); 858 state_->setBoolean(PageAgentState::kScreencastEnabled, true);
849 return Response::OK(); 859 return Response::OK();
850 } 860 }
851 861
852 Response InspectorPageAgent::stopScreencast() { 862 Response InspectorPageAgent::stopScreencast() {
853 state_->setBoolean(PageAgentState::kScreencastEnabled, false); 863 state_->setBoolean(PageAgentState::kScreencastEnabled, false);
854 return Response::OK(); 864 return Response::OK();
855 } 865 }
856 866
867 Response InspectorPageAgent::configureOverlay(Maybe<bool> suspended,
868 Maybe<String> message) {
869 state_->setBoolean(PageAgentState::kOverlaySuspended,
870 suspended.fromMaybe(false));
871 state_->setString(PageAgentState::kOverlaySuspended,
872 message.fromMaybe(String()));
873 if (client_)
874 client_->ConfigureOverlay(suspended.fromMaybe(false),
875 message.fromMaybe(String()));
876 return Response::OK();
877 }
878
857 Response InspectorPageAgent::getLayoutMetrics( 879 Response InspectorPageAgent::getLayoutMetrics(
858 std::unique_ptr<protocol::Page::LayoutViewport>* out_layout_viewport, 880 std::unique_ptr<protocol::Page::LayoutViewport>* out_layout_viewport,
859 std::unique_ptr<protocol::Page::VisualViewport>* out_visual_viewport, 881 std::unique_ptr<protocol::Page::VisualViewport>* out_visual_viewport,
860 std::unique_ptr<protocol::DOM::Rect>* out_content_size) { 882 std::unique_ptr<protocol::DOM::Rect>* out_content_size) {
861 LocalFrame* main_frame = inspected_frames_->Root(); 883 LocalFrame* main_frame = inspected_frames_->Root();
862 VisualViewport& visual_viewport = main_frame->GetPage()->GetVisualViewport(); 884 VisualViewport& visual_viewport = main_frame->GetPage()->GetVisualViewport();
863 885
864 main_frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); 886 main_frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
865 887
866 IntRect visible_contents = main_frame->View()->VisibleContentRect(); 888 IntRect visible_contents = main_frame->View()->VisibleContentRect();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 return Response::OK(); 923 return Response::OK();
902 } 924 }
903 925
904 DEFINE_TRACE(InspectorPageAgent) { 926 DEFINE_TRACE(InspectorPageAgent) {
905 visitor->Trace(inspected_frames_); 927 visitor->Trace(inspected_frames_);
906 visitor->Trace(inspector_resource_content_loader_); 928 visitor->Trace(inspector_resource_content_loader_);
907 InspectorBaseAgent::Trace(visitor); 929 InspectorBaseAgent::Trace(visitor);
908 } 930 }
909 931
910 } // namespace blink 932 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698