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

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

Issue 12431011: Avoid retaining the pointer to inspected WebContents in DevToolsWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 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
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "content/public/browser/devtools_client_host.h" 42 #include "content/public/browser/devtools_client_host.h"
43 #include "content/public/browser/devtools_manager.h" 43 #include "content/public/browser/devtools_manager.h"
44 #include "content/public/browser/favicon_status.h" 44 #include "content/public/browser/favicon_status.h"
45 #include "content/public/browser/load_notification_details.h" 45 #include "content/public/browser/load_notification_details.h"
46 #include "content/public/browser/navigation_controller.h" 46 #include "content/public/browser/navigation_controller.h"
47 #include "content/public/browser/navigation_entry.h" 47 #include "content/public/browser/navigation_entry.h"
48 #include "content/public/browser/notification_source.h" 48 #include "content/public/browser/notification_source.h"
49 #include "content/public/browser/render_process_host.h" 49 #include "content/public/browser/render_process_host.h"
50 #include "content/public/browser/render_view_host.h" 50 #include "content/public/browser/render_view_host.h"
51 #include "content/public/browser/web_contents.h" 51 #include "content/public/browser/web_contents.h"
52 #include "content/public/browser/web_contents_observer.h"
52 #include "content/public/browser/web_contents_view.h" 53 #include "content/public/browser/web_contents_view.h"
53 #include "content/public/common/bindings_policy.h" 54 #include "content/public/common/bindings_policy.h"
54 #include "content/public/common/content_client.h" 55 #include "content/public/common/content_client.h"
55 #include "content/public/common/page_transition_types.h" 56 #include "content/public/common/page_transition_types.h"
56 #include "content/public/common/url_constants.h" 57 #include "content/public/common/url_constants.h"
57 #include "grit/generated_resources.h" 58 #include "grit/generated_resources.h"
58 59
59 typedef std::vector<DevToolsWindow*> DevToolsWindowList; 60 typedef std::vector<DevToolsWindow*> DevToolsWindowList;
60 namespace { 61 namespace {
61 base::LazyInstance<DevToolsWindowList>::Leaky 62 base::LazyInstance<DevToolsWindowList>::Leaky
(...skipping 24 matching lines...) Expand all
86 const char kDockSideBottom[] = "bottom"; 87 const char kDockSideBottom[] = "bottom";
87 const char kDockSideRight[] = "right"; 88 const char kDockSideRight[] = "right";
88 const char kDockSideUndocked[] = "undocked"; 89 const char kDockSideUndocked[] = "undocked";
89 90
90 // Minimal height of devtools pane or content pane when devtools are docked 91 // Minimal height of devtools pane or content pane when devtools are docked
91 // to the browser window. 92 // to the browser window.
92 const int kMinDevToolsHeight = 50; 93 const int kMinDevToolsHeight = 50;
93 const int kMinDevToolsWidth = 150; 94 const int kMinDevToolsWidth = 150;
94 const int kMinContentsSize = 50; 95 const int kMinContentsSize = 50;
95 96
97 class DevToolsWindow::InspectedWebContentsObserver
98 : public content::WebContentsObserver {
99 public:
100 explicit InspectedWebContentsObserver(content::WebContents* web_contents)
101 : WebContentsObserver(web_contents) {
102 }
103
104 content::WebContents* Get() { return web_contents(); }
105 };
106
96 // static 107 // static
97 std::string DevToolsWindow::GetDevToolsWindowPlacementPrefKey() { 108 std::string DevToolsWindow::GetDevToolsWindowPlacementPrefKey() {
98 std::string wp_key; 109 std::string wp_key;
99 wp_key.append(prefs::kBrowserWindowPlacement); 110 wp_key.append(prefs::kBrowserWindowPlacement);
100 wp_key.append("_"); 111 wp_key.append("_");
101 wp_key.append(kDevToolsApp); 112 wp_key.append(kDevToolsApp);
102 return wp_key; 113 return wp_key;
103 } 114 }
104 115
105 // static 116 // static
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 process_id, chrome::kFileScheme); 232 process_id, chrome::kFileScheme);
222 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); 233 content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host);
223 return new DevToolsWindow(web_contents, profile, inspected_rvh, dock_side); 234 return new DevToolsWindow(web_contents, profile, inspected_rvh, dock_side);
224 } 235 }
225 236
226 DevToolsWindow::DevToolsWindow(WebContents* web_contents, 237 DevToolsWindow::DevToolsWindow(WebContents* web_contents,
227 Profile* profile, 238 Profile* profile,
228 RenderViewHost* inspected_rvh, 239 RenderViewHost* inspected_rvh,
229 DevToolsDockSide dock_side) 240 DevToolsDockSide dock_side)
230 : profile_(profile), 241 : profile_(profile),
231 inspected_web_contents_(NULL),
232 web_contents_(web_contents), 242 web_contents_(web_contents),
233 browser_(NULL), 243 browser_(NULL),
234 dock_side_(dock_side), 244 dock_side_(dock_side),
235 is_loaded_(false), 245 is_loaded_(false),
236 action_on_load_(DEVTOOLS_TOGGLE_ACTION_SHOW), 246 action_on_load_(DEVTOOLS_TOGGLE_ACTION_SHOW),
237 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 247 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
238 width_(-1), 248 width_(-1),
239 height_(-1) { 249 height_(-1) {
240 frontend_host_.reset( 250 frontend_host_.reset(
241 DevToolsClientHost::CreateDevToolsFrontendHost(web_contents, this)); 251 DevToolsClientHost::CreateDevToolsFrontendHost(web_contents, this));
(...skipping 14 matching lines...) Expand all
256 this, 266 this,
257 chrome::NOTIFICATION_TAB_CLOSING, 267 chrome::NOTIFICATION_TAB_CLOSING,
258 content::Source<NavigationController>(&web_contents->GetController())); 268 content::Source<NavigationController>(&web_contents->GetController()));
259 registrar_.Add( 269 registrar_.Add(
260 this, 270 this,
261 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 271 chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
262 content::Source<ThemeService>( 272 content::Source<ThemeService>(
263 ThemeServiceFactory::GetForProfile(profile_))); 273 ThemeServiceFactory::GetForProfile(profile_)));
264 // There is no inspected_rvh in case of shared workers. 274 // There is no inspected_rvh in case of shared workers.
265 if (inspected_rvh) 275 if (inspected_rvh)
266 inspected_web_contents_ = WebContents::FromRenderViewHost(inspected_rvh); 276 inspected_contents_observer_.reset(new InspectedWebContentsObserver(
277 WebContents::FromRenderViewHost(inspected_rvh)));
267 } 278 }
268 279
269 DevToolsWindow::~DevToolsWindow() { 280 DevToolsWindow::~DevToolsWindow() {
270 DevToolsWindowList& instances = g_instances.Get(); 281 DevToolsWindowList& instances = g_instances.Get();
271 DevToolsWindowList::iterator it = std::find(instances.begin(), 282 DevToolsWindowList::iterator it = std::find(instances.begin(),
272 instances.end(), 283 instances.end(),
273 this); 284 this);
274 DCHECK(it != instances.end()); 285 DCHECK(it != instances.end());
275 instances.erase(it); 286 instances.erase(it);
276 } 287 }
277 288
289 content::WebContents* DevToolsWindow::GetInspectedWebContents() {
290 if (!inspected_contents_observer_)
291 return NULL;
292 return inspected_contents_observer_->Get();
293 }
294
278 void DevToolsWindow::InspectedContentsClosing() { 295 void DevToolsWindow::InspectedContentsClosing() {
279 if (IsDocked()) { 296 if (IsDocked()) {
280 // Update dev tools to reflect removed dev tools window. 297 // Update dev tools to reflect removed dev tools window.
281 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); 298 BrowserWindow* inspected_window = GetInspectedBrowserWindow();
282 if (inspected_window) 299 if (inspected_window)
283 inspected_window->UpdateDevTools(); 300 inspected_window->UpdateDevTools();
284 // In case of docked web_contents_, we own it so delete here. 301 // In case of docked web_contents_, we own it so delete here.
285 delete web_contents_; 302 delete web_contents_;
286 303
287 delete this; 304 delete this;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 431
415 browser_ = new Browser(Browser::CreateParams::CreateForDevTools( 432 browser_ = new Browser(Browser::CreateParams::CreateForDevTools(
416 profile_, host_desktop_type)); 433 profile_, host_desktop_type));
417 browser_->tab_strip_model()->AddWebContents( 434 browser_->tab_strip_model()->AddWebContents(
418 web_contents_, -1, content::PAGE_TRANSITION_AUTO_TOPLEVEL, 435 web_contents_, -1, content::PAGE_TRANSITION_AUTO_TOPLEVEL,
419 TabStripModel::ADD_ACTIVE); 436 TabStripModel::ADD_ACTIVE);
420 } 437 }
421 438
422 bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser, 439 bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser,
423 int* tab) { 440 int* tab) {
424 if (!inspected_web_contents_) 441 content::WebContents* inspected_web_contents = GetInspectedWebContents();
442 if (!inspected_web_contents)
425 return false; 443 return false;
426 444
427 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 445 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
428 int tab_index = it->tab_strip_model()->GetIndexOfWebContents( 446 int tab_index = it->tab_strip_model()->GetIndexOfWebContents(
429 inspected_web_contents_); 447 inspected_web_contents);
430 if (tab_index != TabStripModel::kNoTab) { 448 if (tab_index != TabStripModel::kNoTab) {
431 *browser = *it; 449 *browser = *it;
432 *tab = tab_index; 450 *tab = tab_index;
433 return true; 451 return true;
434 } 452 }
435 } 453 }
436 return false; 454 return false;
437 } 455 }
438 456
439 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { 457 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() {
(...skipping 14 matching lines...) Expand all
454 472
455 void DevToolsWindow::UpdateFrontendDockSide() { 473 void DevToolsWindow::UpdateFrontendDockSide() {
456 base::StringValue dock_side(SideToString(dock_side_)); 474 base::StringValue dock_side(SideToString(dock_side_));
457 CallClientFunction("InspectorFrontendAPI.setDockSide", &dock_side); 475 CallClientFunction("InspectorFrontendAPI.setDockSide", &dock_side);
458 base::FundamentalValue docked(IsDocked()); 476 base::FundamentalValue docked(IsDocked());
459 CallClientFunction("InspectorFrontendAPI.setAttachedWindow", &docked); 477 CallClientFunction("InspectorFrontendAPI.setAttachedWindow", &docked);
460 } 478 }
461 479
462 480
463 void DevToolsWindow::AddDevToolsExtensionsToClient() { 481 void DevToolsWindow::AddDevToolsExtensionsToClient() {
464 if (inspected_web_contents_) { 482 content::WebContents* inspected_web_contents = GetInspectedWebContents();
483 if (inspected_web_contents) {
465 SessionTabHelper* session_tab_helper = 484 SessionTabHelper* session_tab_helper =
466 SessionTabHelper::FromWebContents(inspected_web_contents_); 485 SessionTabHelper::FromWebContents(inspected_web_contents);
467 if (session_tab_helper) { 486 if (session_tab_helper) {
468 base::FundamentalValue tabId(session_tab_helper->session_id().id()); 487 base::FundamentalValue tabId(session_tab_helper->session_id().id());
469 CallClientFunction("WebInspector.setInspectedTabId", &tabId); 488 CallClientFunction("WebInspector.setInspectedTabId", &tabId);
470 } 489 }
471 } 490 }
472 ListValue results; 491 ListValue results;
473 Profile* profile = 492 Profile* profile =
474 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); 493 Profile::FromBrowserContext(web_contents_->GetBrowserContext());
475 const ExtensionService* extension_service = extensions::ExtensionSystem::Get( 494 const ExtensionService* extension_service = extensions::ExtensionSystem::Get(
476 profile->GetOriginalProfile())->extension_service(); 495 profile->GetOriginalProfile())->extension_service();
(...skipping 15 matching lines...) Expand all
492 extension_info->Set("exposeExperimentalAPIs", 511 extension_info->Set("exposeExperimentalAPIs",
493 new base::FundamentalValue(allow_experimental)); 512 new base::FundamentalValue(allow_experimental));
494 results.Append(extension_info); 513 results.Append(extension_info);
495 } 514 }
496 CallClientFunction("WebInspector.addExtensions", &results); 515 CallClientFunction("WebInspector.addExtensions", &results);
497 } 516 }
498 517
499 WebContents* DevToolsWindow::OpenURLFromTab(WebContents* source, 518 WebContents* DevToolsWindow::OpenURLFromTab(WebContents* source,
500 const OpenURLParams& params) { 519 const OpenURLParams& params) {
501 if (!params.url.SchemeIs(chrome::kChromeDevToolsScheme)) { 520 if (!params.url.SchemeIs(chrome::kChromeDevToolsScheme)) {
502 if (inspected_web_contents_) 521 content::WebContents* inspected_web_contents = GetInspectedWebContents();
503 return inspected_web_contents_->OpenURL(params); 522 if (inspected_web_contents)
523 return inspected_web_contents->OpenURL(params);
504 return NULL; 524 return NULL;
505 } 525 }
506 526
507 DevToolsManager* manager = DevToolsManager::GetInstance(); 527 DevToolsManager* manager = DevToolsManager::GetInstance();
508 scoped_refptr<DevToolsAgentHost> agent_host( 528 scoped_refptr<DevToolsAgentHost> agent_host(
509 manager->GetDevToolsAgentHostFor(frontend_host_.get())); 529 manager->GetDevToolsAgentHostFor(frontend_host_.get()));
510 if (!agent_host) 530 if (!agent_host)
511 return NULL; 531 return NULL;
512 manager->ClientHostClosing(frontend_host_.get()); 532 manager->ClientHostClosing(frontend_host_.get());
513 manager->RegisterDevToolsClientHostFor(agent_host, frontend_host_.get()); 533 manager->RegisterDevToolsClientHostFor(agent_host, frontend_host_.get());
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 web_contents_->GetRenderViewHost()-> 658 web_contents_->GetRenderViewHost()->
639 ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(command)); 659 ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(command));
640 } 660 }
641 661
642 void DevToolsWindow::AddNewContents(WebContents* source, 662 void DevToolsWindow::AddNewContents(WebContents* source,
643 WebContents* new_contents, 663 WebContents* new_contents,
644 WindowOpenDisposition disposition, 664 WindowOpenDisposition disposition,
645 const gfx::Rect& initial_pos, 665 const gfx::Rect& initial_pos,
646 bool user_gesture, 666 bool user_gesture,
647 bool* was_blocked) { 667 bool* was_blocked) {
648 if (inspected_web_contents_) { 668 content::WebContents* inspected_web_contents = GetInspectedWebContents();
649 inspected_web_contents_->GetDelegate()->AddNewContents( 669 if (inspected_web_contents) {
670 inspected_web_contents->GetDelegate()->AddNewContents(
650 source, new_contents, disposition, initial_pos, user_gesture, 671 source, new_contents, disposition, initial_pos, user_gesture,
651 was_blocked); 672 was_blocked);
652 } 673 }
653 } 674 }
654 675
655 bool DevToolsWindow::PreHandleKeyboardEvent( 676 bool DevToolsWindow::PreHandleKeyboardEvent(
656 WebContents* source, 677 WebContents* source,
657 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { 678 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) {
658 if (IsDocked()) { 679 if (IsDocked()) {
659 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); 680 BrowserWindow* inspected_window = GetInspectedBrowserWindow();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 bounds.Offset(x, y); 799 bounds.Offset(x, y);
779 browser_->window()->SetBounds(bounds); 800 browser_->window()->SetBounds(bounds);
780 } 801 }
781 } 802 }
782 803
783 void DevToolsWindow::SetDockSide(const std::string& side) { 804 void DevToolsWindow::SetDockSide(const std::string& side) {
784 DevToolsDockSide requested_side = SideFromString(side); 805 DevToolsDockSide requested_side = SideFromString(side);
785 bool dock_requested = requested_side != DEVTOOLS_DOCK_SIDE_UNDOCKED; 806 bool dock_requested = requested_side != DEVTOOLS_DOCK_SIDE_UNDOCKED;
786 bool is_docked = IsDocked(); 807 bool is_docked = IsDocked();
787 808
788 if (dock_requested && (!inspected_web_contents_ || 809 content::WebContents* inspected_web_contents = GetInspectedWebContents();
810 if (dock_requested && (!inspected_web_contents ||
789 !GetInspectedBrowserWindow() || IsInspectedBrowserPopupOrPanel())) { 811 !GetInspectedBrowserWindow() || IsInspectedBrowserPopupOrPanel())) {
790 // Cannot dock, avoid window flashing due to close-reopen cycle. 812 // Cannot dock, avoid window flashing due to close-reopen cycle.
791 return; 813 return;
792 } 814 }
793 815
794 dock_side_ = requested_side; 816 dock_side_ = requested_side;
795 if (dock_requested) { 817 if (dock_requested) {
796 if (!is_docked) { 818 if (!is_docked) {
797 // Detach window from the external devtools browser. It will lead to 819 // Detach window from the external devtools browser. It will lead to
798 // the browser object's close and delete. Remove observer first. 820 // the browser object's close and delete. Remove observer first.
(...skipping 25 matching lines...) Expand all
824 846
825 Show(DEVTOOLS_TOGGLE_ACTION_SHOW); 847 Show(DEVTOOLS_TOGGLE_ACTION_SHOW);
826 } 848 }
827 849
828 void DevToolsWindow::OpenInNewTab(const std::string& url) { 850 void DevToolsWindow::OpenInNewTab(const std::string& url) {
829 OpenURLParams params(GURL(url), 851 OpenURLParams params(GURL(url),
830 content::Referrer(), 852 content::Referrer(),
831 NEW_FOREGROUND_TAB, 853 NEW_FOREGROUND_TAB,
832 content::PAGE_TRANSITION_LINK, 854 content::PAGE_TRANSITION_LINK,
833 false /* is_renderer_initiated */); 855 false /* is_renderer_initiated */);
834 if (inspected_web_contents_) { 856 content::WebContents* inspected_web_contents = GetInspectedWebContents();
835 inspected_web_contents_->OpenURL(params); 857 if (inspected_web_contents) {
858 inspected_web_contents->OpenURL(params);
836 } else { 859 } else {
837 chrome::HostDesktopType host_desktop_type; 860 chrome::HostDesktopType host_desktop_type;
838 if (browser_) { 861 if (browser_) {
839 host_desktop_type = browser_->host_desktop_type(); 862 host_desktop_type = browser_->host_desktop_type();
840 } else { 863 } else {
841 // There should always be a browser when there are no inspected web 864 // There should always be a browser when there are no inspected web
842 // contents. 865 // contents.
843 NOTREACHED(); 866 NOTREACHED();
844 host_desktop_type = chrome::GetActiveDesktop(); 867 host_desktop_type = chrome::GetActiveDesktop();
845 } 868 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 if (!file_system.file_system_path.empty()) 955 if (!file_system.file_system_path.empty())
933 file_system_value = CreateFileSystemValue(file_system); 956 file_system_value = CreateFileSystemValue(file_system);
934 CallClientFunction("InspectorFrontendAPI.fileSystemAdded", 957 CallClientFunction("InspectorFrontendAPI.fileSystemAdded",
935 &error_string_value, 958 &error_string_value,
936 file_system_value); 959 file_system_value);
937 if (file_system_value) 960 if (file_system_value)
938 delete file_system_value; 961 delete file_system_value;
939 } 962 }
940 963
941 content::JavaScriptDialogManager* DevToolsWindow::GetJavaScriptDialogManager() { 964 content::JavaScriptDialogManager* DevToolsWindow::GetJavaScriptDialogManager() {
942 if (inspected_web_contents_ && inspected_web_contents_->GetDelegate()) { 965 content::WebContents* inspected_web_contents = GetInspectedWebContents();
943 return inspected_web_contents_->GetDelegate()-> 966 if (inspected_web_contents && inspected_web_contents->GetDelegate()) {
967 return inspected_web_contents->GetDelegate()->
944 GetJavaScriptDialogManager(); 968 GetJavaScriptDialogManager();
945 } 969 }
946 return content::WebContentsDelegate::GetJavaScriptDialogManager(); 970 return content::WebContentsDelegate::GetJavaScriptDialogManager();
947 } 971 }
948 972
949 void DevToolsWindow::RunFileChooser(WebContents* web_contents, 973 void DevToolsWindow::RunFileChooser(WebContents* web_contents,
950 const FileChooserParams& params) { 974 const FileChooserParams& params) {
951 FileSelectHelper::RunFileChooser(web_contents, params); 975 FileSelectHelper::RunFileChooser(web_contents, params);
952 } 976 }
953 977
954 void DevToolsWindow::WebContentsFocused(WebContents* contents) { 978 void DevToolsWindow::WebContentsFocused(WebContents* contents) {
955 Browser* inspected_browser = NULL; 979 Browser* inspected_browser = NULL;
956 int inspected_tab_index = -1; 980 int inspected_tab_index = -1;
957 981
958 if (IsDocked() && FindInspectedBrowserAndTabIndex(&inspected_browser, 982 if (IsDocked() && FindInspectedBrowserAndTabIndex(&inspected_browser,
959 &inspected_tab_index)) { 983 &inspected_tab_index)) {
960 inspected_browser->window()->WebContentsFocused(contents); 984 inspected_browser->window()->WebContentsFocused(contents);
961 } 985 }
962 } 986 }
963 987
964 void DevToolsWindow::UpdateBrowserToolbar() { 988 void DevToolsWindow::UpdateBrowserToolbar() {
965 if (!inspected_web_contents_) 989 content::WebContents* inspected_web_contents = GetInspectedWebContents();
990 if (!inspected_web_contents)
966 return; 991 return;
967 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); 992 BrowserWindow* inspected_window = GetInspectedBrowserWindow();
968 if (inspected_window) 993 if (inspected_window)
969 inspected_window->UpdateToolbar(inspected_web_contents_, false); 994 inspected_window->UpdateToolbar(inspected_web_contents, false);
970 } 995 }
971 996
972 bool DevToolsWindow::IsDocked() { 997 bool DevToolsWindow::IsDocked() {
973 return dock_side_ != DEVTOOLS_DOCK_SIDE_UNDOCKED; 998 return dock_side_ != DEVTOOLS_DOCK_SIDE_UNDOCKED;
974 } 999 }
975 1000
976 // static 1001 // static
977 DevToolsDockSide DevToolsWindow::GetDockSideFromPrefs(Profile* profile) { 1002 DevToolsDockSide DevToolsWindow::GetDockSideFromPrefs(Profile* profile) {
978 std::string dock_side = 1003 std::string dock_side =
979 profile->GetPrefs()->GetString(prefs::kDevToolsDockSide); 1004 profile->GetPrefs()->GetString(prefs::kDevToolsDockSide);
(...skipping 28 matching lines...) Expand all
1008 1033
1009 // static 1034 // static
1010 DevToolsDockSide DevToolsWindow::SideFromString( 1035 DevToolsDockSide DevToolsWindow::SideFromString(
1011 const std::string& dock_side) { 1036 const std::string& dock_side) {
1012 if (dock_side == kDockSideRight) 1037 if (dock_side == kDockSideRight)
1013 return DEVTOOLS_DOCK_SIDE_RIGHT; 1038 return DEVTOOLS_DOCK_SIDE_RIGHT;
1014 if (dock_side == kDockSideBottom) 1039 if (dock_side == kDockSideBottom)
1015 return DEVTOOLS_DOCK_SIDE_BOTTOM; 1040 return DEVTOOLS_DOCK_SIDE_BOTTOM;
1016 return DEVTOOLS_DOCK_SIDE_UNDOCKED; 1041 return DEVTOOLS_DOCK_SIDE_UNDOCKED;
1017 } 1042 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | content/browser/devtools/render_view_devtools_agent_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698