OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return window->tab_contents(); | 85 return window->tab_contents(); |
86 } | 86 } |
87 | 87 |
88 // static | 88 // static |
89 bool DevToolsWindow::IsDevToolsWindow(RenderViewHost* window_rvh) { | 89 bool DevToolsWindow::IsDevToolsWindow(RenderViewHost* window_rvh) { |
90 if (g_instances == NULL) | 90 if (g_instances == NULL) |
91 return NULL; | 91 return NULL; |
92 DevToolsWindowList& instances = g_instances.Get(); | 92 DevToolsWindowList& instances = g_instances.Get(); |
93 for (DevToolsWindowList::iterator it = instances.begin(); | 93 for (DevToolsWindowList::iterator it = instances.begin(); |
94 it != instances.end(); ++it) { | 94 it != instances.end(); ++it) { |
95 if ((*it)->tab_contents_->render_view_host() == window_rvh) | 95 if ((*it)->tab_contents_->tab_contents()->render_view_host() == window_rvh) |
96 return true; | 96 return true; |
97 } | 97 } |
98 return false; | 98 return false; |
99 } | 99 } |
100 | 100 |
101 // static | 101 // static |
102 DevToolsWindow* DevToolsWindow::OpenDevToolsWindowForWorker( | 102 DevToolsWindow* DevToolsWindow::OpenDevToolsWindowForWorker( |
103 Profile* profile, | 103 Profile* profile, |
104 DevToolsAgentHost* worker_agent) { | 104 DevToolsAgentHost* worker_agent) { |
105 DevToolsWindow* window; | 105 DevToolsWindow* window; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 | 153 |
154 DevToolsWindow* DevToolsWindow::Create( | 154 DevToolsWindow* DevToolsWindow::Create( |
155 Profile* profile, | 155 Profile* profile, |
156 RenderViewHost* inspected_rvh, | 156 RenderViewHost* inspected_rvh, |
157 bool docked, | 157 bool docked, |
158 bool shared_worker_frontend) { | 158 bool shared_worker_frontend) { |
159 // Create TabContents with devtools. | 159 // Create TabContents with devtools. |
160 TabContentsWrapper* tab_contents = | 160 TabContentsWrapper* tab_contents = |
161 Browser::TabContentsFactory(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); | 161 Browser::TabContentsFactory(profile, NULL, MSG_ROUTING_NONE, NULL, NULL); |
162 tab_contents->render_view_host()->AllowBindings( | 162 tab_contents->tab_contents()->render_view_host()->AllowBindings( |
163 content::BINDINGS_POLICY_WEB_UI); | 163 content::BINDINGS_POLICY_WEB_UI); |
164 tab_contents->controller().LoadURL( | 164 tab_contents->tab_contents()->controller().LoadURL( |
165 GetDevToolsUrl(profile, docked, shared_worker_frontend), | 165 GetDevToolsUrl(profile, docked, shared_worker_frontend), |
166 content::Referrer(), | 166 content::Referrer(), |
167 content::PAGE_TRANSITION_START_PAGE, | 167 content::PAGE_TRANSITION_START_PAGE, |
168 std::string()); | 168 std::string()); |
169 return new DevToolsWindow(tab_contents, profile, inspected_rvh, docked); | 169 return new DevToolsWindow(tab_contents, profile, inspected_rvh, docked); |
170 } | 170 } |
171 | 171 |
172 DevToolsWindow::DevToolsWindow(TabContentsWrapper* tab_contents, | 172 DevToolsWindow::DevToolsWindow(TabContentsWrapper* tab_contents, |
173 Profile* profile, | 173 Profile* profile, |
174 RenderViewHost* inspected_rvh, | 174 RenderViewHost* inspected_rvh, |
175 bool docked) | 175 bool docked) |
176 : profile_(profile), | 176 : profile_(profile), |
177 inspected_tab_(NULL), | 177 inspected_tab_(NULL), |
178 tab_contents_(tab_contents), | 178 tab_contents_(tab_contents), |
179 browser_(NULL), | 179 browser_(NULL), |
180 docked_(docked), | 180 docked_(docked), |
181 is_loaded_(false), | 181 is_loaded_(false), |
182 action_on_load_(DEVTOOLS_TOGGLE_ACTION_NONE), | 182 action_on_load_(DEVTOOLS_TOGGLE_ACTION_NONE), |
183 frontend_host_(NULL) { | 183 frontend_host_(NULL) { |
184 frontend_host_ = DevToolsClientHost::CreateDevToolsFrontendHost( | 184 frontend_host_ = DevToolsClientHost::CreateDevToolsFrontendHost( |
185 tab_contents->tab_contents(), | 185 tab_contents->tab_contents(), |
186 this); | 186 this); |
187 g_instances.Get().push_back(this); | 187 g_instances.Get().push_back(this); |
188 // Wipe out page icon so that the default application icon is used. | 188 // Wipe out page icon so that the default application icon is used. |
189 NavigationEntry* entry = tab_contents_->controller().GetActiveEntry(); | 189 NavigationEntry* entry = |
| 190 tab_contents_->tab_contents()->controller().GetActiveEntry(); |
190 entry->favicon().set_bitmap(SkBitmap()); | 191 entry->favicon().set_bitmap(SkBitmap()); |
191 entry->favicon().set_is_valid(true); | 192 entry->favicon().set_is_valid(true); |
192 | 193 |
193 // Register on-load actions. | 194 // Register on-load actions. |
194 registrar_.Add( | 195 registrar_.Add( |
195 this, | 196 this, |
196 content::NOTIFICATION_LOAD_STOP, | 197 content::NOTIFICATION_LOAD_STOP, |
197 content::Source<NavigationController>(&tab_contents_->controller())); | 198 content::Source<NavigationController>( |
| 199 &tab_contents_->tab_contents()->controller())); |
198 registrar_.Add( | 200 registrar_.Add( |
199 this, | 201 this, |
200 content::NOTIFICATION_TAB_CLOSING, | 202 content::NOTIFICATION_TAB_CLOSING, |
201 content::Source<NavigationController>(&tab_contents_->controller())); | 203 content::Source<NavigationController>( |
| 204 &tab_contents_->tab_contents()->controller())); |
202 registrar_.Add( | 205 registrar_.Add( |
203 this, | 206 this, |
204 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 207 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
205 content::Source<ThemeService>( | 208 content::Source<ThemeService>( |
206 ThemeServiceFactory::GetForProfile(profile_))); | 209 ThemeServiceFactory::GetForProfile(profile_))); |
207 // There is no inspected_rvh in case of shared workers. | 210 // There is no inspected_rvh in case of shared workers. |
208 if (inspected_rvh) { | 211 if (inspected_rvh) { |
209 TabContents* tab = inspected_rvh->delegate()->GetAsTabContents(); | 212 TabContents* tab = inspected_rvh->delegate()->GetAsTabContents(); |
210 if (tab) | 213 if (tab) |
211 inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); | 214 inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 if (docked_) { | 259 if (docked_) { |
257 Browser* inspected_browser; | 260 Browser* inspected_browser; |
258 int inspected_tab_index; | 261 int inspected_tab_index; |
259 // Tell inspected browser to update splitter and switch to inspected panel. | 262 // Tell inspected browser to update splitter and switch to inspected panel. |
260 if (!IsInspectedBrowserPopupOrPanel() && | 263 if (!IsInspectedBrowserPopupOrPanel() && |
261 FindInspectedBrowserAndTabIndex(&inspected_browser, | 264 FindInspectedBrowserAndTabIndex(&inspected_browser, |
262 &inspected_tab_index)) { | 265 &inspected_tab_index)) { |
263 BrowserWindow* inspected_window = inspected_browser->window(); | 266 BrowserWindow* inspected_window = inspected_browser->window(); |
264 tab_contents_->tab_contents()->set_delegate(this); | 267 tab_contents_->tab_contents()->set_delegate(this); |
265 inspected_window->UpdateDevTools(); | 268 inspected_window->UpdateDevTools(); |
266 tab_contents_->view()->SetInitialFocus(); | 269 tab_contents_->tab_contents()->view()->SetInitialFocus(); |
267 inspected_window->Show(); | 270 inspected_window->Show(); |
268 TabStripModel* tabstrip_model = inspected_browser->tabstrip_model(); | 271 TabStripModel* tabstrip_model = inspected_browser->tabstrip_model(); |
269 tabstrip_model->ActivateTabAt(inspected_tab_index, true); | 272 tabstrip_model->ActivateTabAt(inspected_tab_index, true); |
270 ScheduleAction(action); | 273 ScheduleAction(action); |
271 return; | 274 return; |
272 } else { | 275 } else { |
273 // Sometimes we don't know where to dock. Stay undocked. | 276 // Sometimes we don't know where to dock. Stay undocked. |
274 docked_ = false; | 277 docked_ = false; |
275 UpdateFrontendAttachedState(); | 278 UpdateFrontendAttachedState(); |
276 } | 279 } |
277 } | 280 } |
278 | 281 |
279 // Avoid consecutive window switching if the devtools window has been opened | 282 // Avoid consecutive window switching if the devtools window has been opened |
280 // and the Inspect Element shortcut is pressed in the inspected tab. | 283 // and the Inspect Element shortcut is pressed in the inspected tab. |
281 bool should_show_window = | 284 bool should_show_window = |
282 !browser_ || action != DEVTOOLS_TOGGLE_ACTION_INSPECT; | 285 !browser_ || action != DEVTOOLS_TOGGLE_ACTION_INSPECT; |
283 | 286 |
284 if (!browser_) | 287 if (!browser_) |
285 CreateDevToolsBrowser(); | 288 CreateDevToolsBrowser(); |
286 | 289 |
287 if (should_show_window) { | 290 if (should_show_window) { |
288 browser_->window()->Show(); | 291 browser_->window()->Show(); |
289 tab_contents_->view()->SetInitialFocus(); | 292 tab_contents_->tab_contents()->view()->SetInitialFocus(); |
290 } | 293 } |
291 | 294 |
292 ScheduleAction(action); | 295 ScheduleAction(action); |
293 } | 296 } |
294 | 297 |
295 void DevToolsWindow::RequestSetDocked(bool docked) { | 298 void DevToolsWindow::RequestSetDocked(bool docked) { |
296 if (docked_ == docked) | 299 if (docked_ == docked) |
297 return; | 300 return; |
298 | 301 |
299 if (!inspected_tab_) | 302 if (!inspected_tab_) |
(...skipping 20 matching lines...) Expand all Loading... |
320 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); | 323 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); |
321 if (inspected_window) { | 324 if (inspected_window) { |
322 inspected_window->UpdateDevTools(); | 325 inspected_window->UpdateDevTools(); |
323 inspected_window = NULL; | 326 inspected_window = NULL; |
324 } | 327 } |
325 } | 328 } |
326 Show(DEVTOOLS_TOGGLE_ACTION_NONE); | 329 Show(DEVTOOLS_TOGGLE_ACTION_NONE); |
327 } | 330 } |
328 | 331 |
329 RenderViewHost* DevToolsWindow::GetRenderViewHost() { | 332 RenderViewHost* DevToolsWindow::GetRenderViewHost() { |
330 return tab_contents_->render_view_host(); | 333 return tab_contents_->tab_contents()->render_view_host(); |
331 } | 334 } |
332 | 335 |
333 void DevToolsWindow::CreateDevToolsBrowser() { | 336 void DevToolsWindow::CreateDevToolsBrowser() { |
334 // TODO(pfeldman): Make browser's getter for this key static. | 337 // TODO(pfeldman): Make browser's getter for this key static. |
335 std::string wp_key; | 338 std::string wp_key; |
336 wp_key.append(prefs::kBrowserWindowPlacement); | 339 wp_key.append(prefs::kBrowserWindowPlacement); |
337 wp_key.append("_"); | 340 wp_key.append("_"); |
338 wp_key.append(kDevToolsApp); | 341 wp_key.append(kDevToolsApp); |
339 | 342 |
340 PrefService* prefs = profile_->GetPrefs(); | 343 PrefService* prefs = profile_->GetPrefs(); |
(...skipping 17 matching lines...) Expand all Loading... |
358 browser_->tabstrip_model()->AddTabContents( | 361 browser_->tabstrip_model()->AddTabContents( |
359 tab_contents_, -1, content::PAGE_TRANSITION_START_PAGE, | 362 tab_contents_, -1, content::PAGE_TRANSITION_START_PAGE, |
360 TabStripModel::ADD_ACTIVE); | 363 TabStripModel::ADD_ACTIVE); |
361 } | 364 } |
362 | 365 |
363 bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser, | 366 bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser, |
364 int* tab) { | 367 int* tab) { |
365 if (!inspected_tab_) | 368 if (!inspected_tab_) |
366 return false; | 369 return false; |
367 | 370 |
368 const NavigationController& controller = inspected_tab_->controller(); | 371 const NavigationController& controller = |
| 372 inspected_tab_->tab_contents()->controller(); |
369 for (BrowserList::const_iterator it = BrowserList::begin(); | 373 for (BrowserList::const_iterator it = BrowserList::begin(); |
370 it != BrowserList::end(); ++it) { | 374 it != BrowserList::end(); ++it) { |
371 int tab_index = (*it)->GetIndexOfController(&controller); | 375 int tab_index = (*it)->GetIndexOfController(&controller); |
372 if (tab_index != TabStripModel::kNoTab) { | 376 if (tab_index != TabStripModel::kNoTab) { |
373 *browser = *it; | 377 *browser = *it; |
374 *tab = tab_index; | 378 *tab = tab_index; |
375 return true; | 379 return true; |
376 } | 380 } |
377 } | 381 } |
378 return false; | 382 return false; |
379 } | 383 } |
380 | 384 |
381 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { | 385 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { |
382 Browser* browser = NULL; | 386 Browser* browser = NULL; |
383 int tab; | 387 int tab; |
384 return FindInspectedBrowserAndTabIndex(&browser, &tab) ? | 388 return FindInspectedBrowserAndTabIndex(&browser, &tab) ? |
385 browser->window() : NULL; | 389 browser->window() : NULL; |
386 } | 390 } |
387 | 391 |
388 bool DevToolsWindow::IsInspectedBrowserPopupOrPanel() { | 392 bool DevToolsWindow::IsInspectedBrowserPopupOrPanel() { |
389 Browser* browser = NULL; | 393 Browser* browser = NULL; |
390 int tab; | 394 int tab; |
391 if (!FindInspectedBrowserAndTabIndex(&browser, &tab)) | 395 if (!FindInspectedBrowserAndTabIndex(&browser, &tab)) |
392 return false; | 396 return false; |
393 | 397 |
394 return browser->is_type_popup() || browser->is_type_panel(); | 398 return browser->is_type_popup() || browser->is_type_panel(); |
395 } | 399 } |
396 | 400 |
397 void DevToolsWindow::UpdateFrontendAttachedState() { | 401 void DevToolsWindow::UpdateFrontendAttachedState() { |
398 tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( | 402 tab_contents_->tab_contents()->render_view_host()-> |
399 string16(), | 403 ExecuteJavascriptInWebFrame( |
400 docked_ ? ASCIIToUTF16("WebInspector.setAttachedWindow(true);") | 404 string16(), |
401 : ASCIIToUTF16("WebInspector.setAttachedWindow(false);")); | 405 docked_ ? ASCIIToUTF16("WebInspector.setAttachedWindow(true);") |
| 406 : ASCIIToUTF16("WebInspector.setAttachedWindow(false);")); |
402 } | 407 } |
403 | 408 |
404 | 409 |
405 void DevToolsWindow::AddDevToolsExtensionsToClient() { | 410 void DevToolsWindow::AddDevToolsExtensionsToClient() { |
406 if (inspected_tab_) { | 411 if (inspected_tab_) { |
407 base::FundamentalValue tabId( | 412 base::FundamentalValue tabId( |
408 inspected_tab_->restore_tab_helper()->session_id().id()); | 413 inspected_tab_->restore_tab_helper()->session_id().id()); |
409 CallClientFunction(ASCIIToUTF16("WebInspector.setInspectedTabId"), tabId); | 414 CallClientFunction(ASCIIToUTF16("WebInspector.setInspectedTabId"), tabId); |
410 } | 415 } |
411 ListValue results; | 416 ListValue results; |
(...skipping 27 matching lines...) Expand all Loading... |
439 } | 444 } |
440 return NULL; | 445 return NULL; |
441 } | 446 } |
442 | 447 |
443 void DevToolsWindow::CallClientFunction(const string16& function_name, | 448 void DevToolsWindow::CallClientFunction(const string16& function_name, |
444 const Value& arg) { | 449 const Value& arg) { |
445 std::string json; | 450 std::string json; |
446 base::JSONWriter::Write(&arg, false, &json); | 451 base::JSONWriter::Write(&arg, false, &json); |
447 string16 javascript = function_name + char16('(') + UTF8ToUTF16(json) + | 452 string16 javascript = function_name + char16('(') + UTF8ToUTF16(json) + |
448 ASCIIToUTF16(");"); | 453 ASCIIToUTF16(");"); |
449 tab_contents_->render_view_host()-> | 454 tab_contents_->tab_contents()->render_view_host()-> |
450 ExecuteJavascriptInWebFrame(string16(), javascript); | 455 ExecuteJavascriptInWebFrame(string16(), javascript); |
451 } | 456 } |
452 | 457 |
453 void DevToolsWindow::Observe(int type, | 458 void DevToolsWindow::Observe(int type, |
454 const content::NotificationSource& source, | 459 const content::NotificationSource& source, |
455 const content::NotificationDetails& details) { | 460 const content::NotificationDetails& details) { |
456 if (type == content::NOTIFICATION_LOAD_STOP && !is_loaded_) { | 461 if (type == content::NOTIFICATION_LOAD_STOP && !is_loaded_) { |
457 is_loaded_ = true; | 462 is_loaded_ = true; |
458 UpdateTheme(); | 463 UpdateTheme(); |
459 DoAction(); | 464 DoAction(); |
460 AddDevToolsExtensionsToClient(); | 465 AddDevToolsExtensionsToClient(); |
461 } else if (type == content::NOTIFICATION_TAB_CLOSING) { | 466 } else if (type == content::NOTIFICATION_TAB_CLOSING) { |
462 if (content::Source<NavigationController>(source).ptr() == | 467 if (content::Source<NavigationController>(source).ptr() == |
463 &tab_contents_->controller()) { | 468 &tab_contents_->tab_contents()->controller()) { |
464 // This happens when browser closes all of its tabs as a result | 469 // This happens when browser closes all of its tabs as a result |
465 // of window.Close event. | 470 // of window.Close event. |
466 // Notify manager that this DevToolsClientHost no longer exists and | 471 // Notify manager that this DevToolsClientHost no longer exists and |
467 // initiate self-destuct here. | 472 // initiate self-destuct here. |
468 DevToolsManager::GetInstance()->ClientHostClosing(frontend_host_); | 473 DevToolsManager::GetInstance()->ClientHostClosing(frontend_host_); |
469 delete this; | 474 delete this; |
470 } | 475 } |
471 } else if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { | 476 } else if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { |
472 UpdateTheme(); | 477 UpdateTheme(); |
473 } | 478 } |
474 } | 479 } |
475 | 480 |
476 void DevToolsWindow::ScheduleAction(DevToolsToggleAction action) { | 481 void DevToolsWindow::ScheduleAction(DevToolsToggleAction action) { |
477 action_on_load_ = action; | 482 action_on_load_ = action; |
478 if (is_loaded_) | 483 if (is_loaded_) |
479 DoAction(); | 484 DoAction(); |
480 } | 485 } |
481 | 486 |
482 void DevToolsWindow::DoAction() { | 487 void DevToolsWindow::DoAction() { |
483 UpdateFrontendAttachedState(); | 488 UpdateFrontendAttachedState(); |
484 // TODO: these messages should be pushed through the WebKit API instead. | 489 // TODO: these messages should be pushed through the WebKit API instead. |
485 switch (action_on_load_) { | 490 switch (action_on_load_) { |
486 case DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE: | 491 case DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE: |
487 tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( | 492 tab_contents_->tab_contents()->render_view_host()-> |
488 string16(), ASCIIToUTF16("WebInspector.showConsole();")); | 493 ExecuteJavascriptInWebFrame( |
| 494 string16(), |
| 495 ASCIIToUTF16("WebInspector.showConsole();")); |
489 break; | 496 break; |
490 case DEVTOOLS_TOGGLE_ACTION_INSPECT: | 497 case DEVTOOLS_TOGGLE_ACTION_INSPECT: |
491 tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( | 498 tab_contents_->tab_contents()->render_view_host()-> |
492 string16(), ASCIIToUTF16("WebInspector.toggleSearchingForNode();")); | 499 ExecuteJavascriptInWebFrame( |
| 500 string16(), |
| 501 ASCIIToUTF16("WebInspector.toggleSearchingForNode();")); |
493 case DEVTOOLS_TOGGLE_ACTION_NONE: | 502 case DEVTOOLS_TOGGLE_ACTION_NONE: |
494 // Do nothing. | 503 // Do nothing. |
495 break; | 504 break; |
496 default: | 505 default: |
497 NOTREACHED(); | 506 NOTREACHED(); |
498 } | 507 } |
499 action_on_load_ = DEVTOOLS_TOGGLE_ACTION_NONE; | 508 action_on_load_ = DEVTOOLS_TOGGLE_ACTION_NONE; |
500 } | 509 } |
501 | 510 |
502 std::string SkColorToRGBAString(SkColor color) { | 511 std::string SkColorToRGBAString(SkColor color) { |
(...skipping 29 matching lines...) Expand all Loading... |
532 CHECK(tp); | 541 CHECK(tp); |
533 | 542 |
534 SkColor color_toolbar = | 543 SkColor color_toolbar = |
535 tp->GetColor(ThemeService::COLOR_TOOLBAR); | 544 tp->GetColor(ThemeService::COLOR_TOOLBAR); |
536 SkColor color_tab_text = | 545 SkColor color_tab_text = |
537 tp->GetColor(ThemeService::COLOR_BOOKMARK_TEXT); | 546 tp->GetColor(ThemeService::COLOR_BOOKMARK_TEXT); |
538 std::string command = StringPrintf( | 547 std::string command = StringPrintf( |
539 "WebInspector.setToolbarColors(\"%s\", \"%s\")", | 548 "WebInspector.setToolbarColors(\"%s\", \"%s\")", |
540 SkColorToRGBAString(color_toolbar).c_str(), | 549 SkColorToRGBAString(color_toolbar).c_str(), |
541 SkColorToRGBAString(color_tab_text).c_str()); | 550 SkColorToRGBAString(color_tab_text).c_str()); |
542 tab_contents_->render_view_host()-> | 551 tab_contents_->tab_contents()->render_view_host()-> |
543 ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(command)); | 552 ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(command)); |
544 } | 553 } |
545 | 554 |
546 void DevToolsWindow::AddNewContents(TabContents* source, | 555 void DevToolsWindow::AddNewContents(TabContents* source, |
547 TabContents* new_contents, | 556 TabContents* new_contents, |
548 WindowOpenDisposition disposition, | 557 WindowOpenDisposition disposition, |
549 const gfx::Rect& initial_pos, | 558 const gfx::Rect& initial_pos, |
550 bool user_gesture) { | 559 bool user_gesture) { |
551 if (inspected_tab_) { | 560 if (inspected_tab_) { |
552 inspected_tab_->tab_contents()->delegate()->AddNewContents( | 561 inspected_tab_->tab_contents()->delegate()->AddNewContents( |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 } | 640 } |
632 | 641 |
633 void DevToolsWindow::ActivateWindow() { | 642 void DevToolsWindow::ActivateWindow() { |
634 if (!docked_) { | 643 if (!docked_) { |
635 if (!browser_->window()->IsActive()) { | 644 if (!browser_->window()->IsActive()) { |
636 browser_->window()->Activate(); | 645 browser_->window()->Activate(); |
637 } | 646 } |
638 } else { | 647 } else { |
639 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); | 648 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); |
640 if (inspected_window) | 649 if (inspected_window) |
641 tab_contents_->view()->Focus(); | 650 tab_contents_->tab_contents()->view()->Focus(); |
642 } | 651 } |
643 } | 652 } |
644 | 653 |
645 void DevToolsWindow::CloseWindow() { | 654 void DevToolsWindow::CloseWindow() { |
646 DCHECK(docked_); | 655 DCHECK(docked_); |
647 DevToolsManager::GetInstance()->ClientHostClosing(frontend_host_); | 656 DevToolsManager::GetInstance()->ClientHostClosing(frontend_host_); |
648 InspectedTabClosing(); | 657 InspectedTabClosing(); |
649 } | 658 } |
650 | 659 |
651 void DevToolsWindow::MoveWindow(int x, int y) { | 660 void DevToolsWindow::MoveWindow(int x, int y) { |
(...skipping 19 matching lines...) Expand all Loading... |
671 content); | 680 content); |
672 } | 681 } |
673 | 682 |
674 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 683 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
675 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { | 684 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { |
676 return inspected_tab_->tab_contents()->delegate()-> | 685 return inspected_tab_->tab_contents()->delegate()-> |
677 GetJavaScriptDialogCreator(); | 686 GetJavaScriptDialogCreator(); |
678 } | 687 } |
679 return TabContentsDelegate::GetJavaScriptDialogCreator(); | 688 return TabContentsDelegate::GetJavaScriptDialogCreator(); |
680 } | 689 } |
OLD | NEW |