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

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 2939173002: Reland of [DevTools] Show icon in top toolbar when Node target is available (Closed)
Patch Set: Created 3 years, 6 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/devtools/devtools_window.h" 5 #include "chrome/browser/devtools/devtools_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 return; 578 return;
579 window->bindings_->AttachTo(agent_host); 579 window->bindings_->AttachTo(agent_host);
580 window->close_on_detach_ = false; 580 window->close_on_detach_ = false;
581 } 581 }
582 582
583 window->ScheduleShow(DevToolsToggleAction::Show()); 583 window->ScheduleShow(DevToolsToggleAction::Show());
584 } 584 }
585 585
586 // static 586 // static
587 void DevToolsWindow::OpenNodeFrontendWindow(Profile* profile) { 587 void DevToolsWindow::OpenNodeFrontendWindow(Profile* profile) {
588 for (DevToolsWindow* window : g_instances.Get()) {
589 if (window->frontend_type_ == kFrontendNode) {
590 window->ActivateWindow();
591 return;
592 }
593 }
594
588 DevToolsWindow* window = 595 DevToolsWindow* window =
589 Create(profile, nullptr, kFrontendNode, std::string(), false, 596 Create(profile, nullptr, kFrontendNode, std::string(), false,
590 std::string(), std::string()); 597 std::string(), std::string());
591 if (!window) 598 if (!window)
592 return; 599 return;
593 window->bindings_->AttachTo(DevToolsAgentHost::CreateForDiscovery()); 600 window->bindings_->AttachTo(DevToolsAgentHost::CreateForDiscovery());
594 window->ScheduleShow(DevToolsToggleAction::Show()); 601 window->ScheduleShow(DevToolsToggleAction::Show());
595 } 602 }
596 603
597 // static 604 // static
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 void DevToolsWindow::OnPageCloseCanceled(WebContents* contents) { 806 void DevToolsWindow::OnPageCloseCanceled(WebContents* contents) {
800 DevToolsWindow* window = 807 DevToolsWindow* window =
801 DevToolsWindow::GetInstanceForInspectedWebContents(contents); 808 DevToolsWindow::GetInstanceForInspectedWebContents(contents);
802 if (!window) 809 if (!window)
803 return; 810 return;
804 window->intercepted_page_beforeunload_ = false; 811 window->intercepted_page_beforeunload_ = false;
805 // Propagate to devtools opened on devtools if any. 812 // Propagate to devtools opened on devtools if any.
806 DevToolsWindow::OnPageCloseCanceled(window->main_web_contents_); 813 DevToolsWindow::OnPageCloseCanceled(window->main_web_contents_);
807 } 814 }
808 815
809 DevToolsWindow::DevToolsWindow(Profile* profile, 816 DevToolsWindow::DevToolsWindow(FrontendType frontend_type,
817 Profile* profile,
810 WebContents* main_web_contents, 818 WebContents* main_web_contents,
811 DevToolsUIBindings* bindings, 819 DevToolsUIBindings* bindings,
812 WebContents* inspected_web_contents, 820 WebContents* inspected_web_contents,
813 bool can_dock) 821 bool can_dock)
814 : profile_(profile), 822 : frontend_type_(frontend_type),
823 profile_(profile),
815 main_web_contents_(main_web_contents), 824 main_web_contents_(main_web_contents),
816 toolbox_web_contents_(nullptr), 825 toolbox_web_contents_(nullptr),
817 bindings_(bindings), 826 bindings_(bindings),
818 browser_(nullptr), 827 browser_(nullptr),
819 is_docked_(true), 828 is_docked_(true),
820 can_dock_(can_dock), 829 can_dock_(can_dock),
821 close_on_detach_(true), 830 close_on_detach_(true),
822 // This initialization allows external front-end to work without changes. 831 // This initialization allows external front-end to work without changes.
823 // We don't wait for docking call, but instead immediately show undocked. 832 // We don't wait for docking call, but instead immediately show undocked.
824 // Passing "dockSide=undocked" parameter ensures proper UI. 833 // Passing "dockSide=undocked" parameter ensures proper UI.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 WebContents::Create(WebContents::CreateParams(profile))); 908 WebContents::Create(WebContents::CreateParams(profile)));
900 main_web_contents->GetController().LoadURL( 909 main_web_contents->GetController().LoadURL(
901 DecorateFrontendURL(url), content::Referrer(), 910 DecorateFrontendURL(url), content::Referrer(),
902 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); 911 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string());
903 DevToolsUIBindings* bindings = 912 DevToolsUIBindings* bindings =
904 DevToolsUIBindings::ForWebContents(main_web_contents.get()); 913 DevToolsUIBindings::ForWebContents(main_web_contents.get());
905 if (!bindings) 914 if (!bindings)
906 return nullptr; 915 return nullptr;
907 if (!settings.empty()) 916 if (!settings.empty())
908 SetPreferencesFromJson(profile, settings); 917 SetPreferencesFromJson(profile, settings);
909 return new DevToolsWindow(profile, main_web_contents.release(), bindings, 918 return new DevToolsWindow(frontend_type, profile, main_web_contents.release(),
910 inspected_web_contents, can_dock); 919 bindings, inspected_web_contents, can_dock);
911 } 920 }
912 921
913 // static 922 // static
914 GURL DevToolsWindow::GetDevToolsURL(Profile* profile, 923 GURL DevToolsWindow::GetDevToolsURL(Profile* profile,
915 FrontendType frontend_type, 924 FrontendType frontend_type,
916 const std::string& frontend_url, 925 const std::string& frontend_url,
917 bool can_dock, 926 bool can_dock,
918 const std::string& panel) { 927 const std::string& panel) {
919 std::string url(!frontend_url.empty() ? frontend_url 928 std::string url(!frontend_url.empty() ? frontend_url
920 : chrome::kChromeUIDevToolsURL); 929 : chrome::kChromeUIDevToolsURL);
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { 1436 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) {
1428 // Only route reload via front-end if the agent is attached. 1437 // Only route reload via front-end if the agent is attached.
1429 WebContents* wc = GetInspectedWebContents(); 1438 WebContents* wc = GetInspectedWebContents();
1430 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1439 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1431 return false; 1440 return false;
1432 base::Value bypass_cache_value(bypass_cache); 1441 base::Value bypass_cache_value(bypass_cache);
1433 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1442 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1434 &bypass_cache_value, nullptr, nullptr); 1443 &bypass_cache_value, nullptr, nullptr);
1435 return true; 1444 return true;
1436 } 1445 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | content/browser/devtools/protocol/target_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698