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

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

Issue 2179923002: Add a JavaScript dialog tab helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 3 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 | chrome/browser/extensions/content_script_apitest.cc » ('j') | 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
24 #include "chrome/browser/ui/browser_tabstrip.h" 24 #include "chrome/browser/ui/browser_tabstrip.h"
25 #include "chrome/browser/ui/browser_window.h" 25 #include "chrome/browser/ui/browser_window.h"
26 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 26 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 27 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
29 #include "chrome/browser/ui/webui/devtools_ui.h" 29 #include "chrome/browser/ui/webui/devtools_ui.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "chrome/common/url_constants.h" 32 #include "chrome/common/url_constants.h"
33 #include "components/app_modal/javascript_dialog_manager.h"
33 #include "components/pref_registry/pref_registry_syncable.h" 34 #include "components/pref_registry/pref_registry_syncable.h"
34 #include "components/prefs/scoped_user_pref_update.h" 35 #include "components/prefs/scoped_user_pref_update.h"
35 #include "components/syncable_prefs/pref_service_syncable.h" 36 #include "components/syncable_prefs/pref_service_syncable.h"
36 #include "components/zoom/page_zoom.h" 37 #include "components/zoom/page_zoom.h"
37 #include "components/zoom/zoom_controller.h" 38 #include "components/zoom/zoom_controller.h"
38 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/devtools_agent_host.h" 40 #include "content/public/browser/devtools_agent_host.h"
40 #include "content/public/browser/native_web_keyboard_event.h" 41 #include "content/public/browser/native_web_keyboard_event.h"
41 #include "content/public/browser/navigation_controller.h" 42 #include "content/public/browser/navigation_controller.h"
42 #include "content/public/browser/navigation_entry.h" 43 #include "content/public/browser/navigation_entry.h"
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 // Do not navigate back in history on Windows (http://crbug.com/74156). 1031 // Do not navigate back in history on Windows (http://crbug.com/74156).
1031 return; 1032 return;
1032 } 1033 }
1033 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); 1034 BrowserWindow* inspected_window = GetInspectedBrowserWindow();
1034 if (inspected_window) 1035 if (inspected_window)
1035 inspected_window->HandleKeyboardEvent(event); 1036 inspected_window->HandleKeyboardEvent(event);
1036 } 1037 }
1037 1038
1038 content::JavaScriptDialogManager* DevToolsWindow::GetJavaScriptDialogManager( 1039 content::JavaScriptDialogManager* DevToolsWindow::GetJavaScriptDialogManager(
1039 WebContents* source) { 1040 WebContents* source) {
1040 WebContents* inspected_web_contents = GetInspectedWebContents(); 1041 return app_modal::JavaScriptDialogManager::GetInstance();
1041 return (inspected_web_contents && inspected_web_contents->GetDelegate())
1042 ? inspected_web_contents->GetDelegate()
1043 ->GetJavaScriptDialogManager(inspected_web_contents)
1044 : content::WebContentsDelegate::GetJavaScriptDialogManager(source);
1045 } 1042 }
1046 1043
1047 content::ColorChooser* DevToolsWindow::OpenColorChooser( 1044 content::ColorChooser* DevToolsWindow::OpenColorChooser(
1048 WebContents* web_contents, 1045 WebContents* web_contents,
1049 SkColor initial_color, 1046 SkColor initial_color,
1050 const std::vector<content::ColorSuggestion>& suggestions) { 1047 const std::vector<content::ColorSuggestion>& suggestions) {
1051 return chrome::ShowColorChooser(web_contents, initial_color); 1048 return chrome::ShowColorChooser(web_contents, initial_color);
1052 } 1049 }
1053 1050
1054 void DevToolsWindow::RunFileChooser(content::RenderFrameHost* render_frame_host, 1051 void DevToolsWindow::RunFileChooser(content::RenderFrameHost* render_frame_host,
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { 1320 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) {
1324 // Only route reload via front-end if the agent is attached. 1321 // Only route reload via front-end if the agent is attached.
1325 WebContents* wc = GetInspectedWebContents(); 1322 WebContents* wc = GetInspectedWebContents();
1326 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1323 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1327 return false; 1324 return false;
1328 base::FundamentalValue bypass_cache_value(bypass_cache); 1325 base::FundamentalValue bypass_cache_value(bypass_cache);
1329 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1326 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1330 &bypass_cache_value, nullptr, nullptr); 1327 &bypass_cache_value, nullptr, nullptr);
1331 return true; 1328 return true;
1332 } 1329 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/content_script_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698