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

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

Issue 972123003: Fixed behavior in case of disabled devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 // static 404 // static
405 DevToolsWindow* DevToolsWindow::CreateDevToolsWindowForWorker( 405 DevToolsWindow* DevToolsWindow::CreateDevToolsWindowForWorker(
406 Profile* profile) { 406 Profile* profile) {
407 content::RecordAction(base::UserMetricsAction("DevTools_InspectWorker")); 407 content::RecordAction(base::UserMetricsAction("DevTools_InspectWorker"));
408 return Create(profile, GURL(), NULL, true, std::string(), false, ""); 408 return Create(profile, GURL(), NULL, true, std::string(), false, "");
409 } 409 }
410 410
411 // static 411 // static
412 DevToolsWindow* DevToolsWindow::OpenDevToolsWindow( 412 DevToolsWindow* DevToolsWindow::OpenDevToolsWindow(
413 content::WebContents* inspected_web_contents) { 413 content::WebContents* inspected_web_contents) {
414 return ToggleDevToolsWindow( 414 return DevToolsWindow::OpenDevToolsWindow(
415 inspected_web_contents, true, DevToolsToggleAction::Show(), ""); 415 inspected_web_contents, DevToolsToggleAction::Show());
416 } 416 }
417 417
418 // static 418 // static
419 DevToolsWindow* DevToolsWindow::OpenDevToolsWindow( 419 DevToolsWindow* DevToolsWindow::OpenDevToolsWindow(
420 content::WebContents* inspected_web_contents, 420 content::WebContents* inspected_web_contents,
421 const DevToolsToggleAction& action) { 421 const DevToolsToggleAction& action) {
422 Profile* profile = Profile::FromBrowserContext(
423 inspected_web_contents->GetBrowserContext());
424 // If development tools disabled by policy return NULL
dgozman 2015/03/03 14:07:24 nit: "null" please
425 if (profile->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) {
426 return NULL;
dgozman 2015/03/03 14:07:24 nullptr
427 }
422 return ToggleDevToolsWindow(inspected_web_contents, true, action, ""); 428 return ToggleDevToolsWindow(inspected_web_contents, true, action, "");
423 } 429 }
424 430
425 // static 431 // static
426 DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow( 432 DevToolsWindow* DevToolsWindow::ToggleDevToolsWindow(
427 Browser* browser, 433 Browser* browser,
428 const DevToolsToggleAction& action) { 434 const DevToolsToggleAction& action) {
429 if (action.type() == DevToolsToggleAction::kToggle && 435 if (action.type() == DevToolsToggleAction::kToggle &&
430 browser->is_devtools()) { 436 browser->is_devtools()) {
431 browser->tab_strip_model()->CloseAllTabs(); 437 browser->tab_strip_model()->CloseAllTabs();
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 closure.Run(); 1209 closure.Run();
1204 return; 1210 return;
1205 } 1211 }
1206 load_completed_callback_ = closure; 1212 load_completed_callback_ = closure;
1207 } 1213 }
1208 1214
1209 bool DevToolsWindow::ForwardKeyboardEvent( 1215 bool DevToolsWindow::ForwardKeyboardEvent(
1210 const content::NativeWebKeyboardEvent& event) { 1216 const content::NativeWebKeyboardEvent& event) {
1211 return event_forwarder_->ForwardEvent(event); 1217 return event_forwarder_->ForwardEvent(event);
1212 } 1218 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698