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

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

Issue 1158523002: Add user_gesture param to BaseWindow::Show Base URL: https://chromium.googlesource.com/chromium/src.git@ug3_BaseWindow_Activate
Patch Set: Update callers Created 5 years, 7 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/api/tabs/tabs_api.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/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 544
545 // Tell inspected browser to update splitter and switch to inspected panel. 545 // Tell inspected browser to update splitter and switch to inspected panel.
546 BrowserWindow* inspected_window = inspected_browser->window(); 546 BrowserWindow* inspected_window = inspected_browser->window();
547 main_web_contents_->SetDelegate(this); 547 main_web_contents_->SetDelegate(this);
548 548
549 TabStripModel* tab_strip_model = inspected_browser->tab_strip_model(); 549 TabStripModel* tab_strip_model = inspected_browser->tab_strip_model();
550 tab_strip_model->ActivateTabAt(inspected_tab_index, true); 550 tab_strip_model->ActivateTabAt(inspected_tab_index, true);
551 551
552 inspected_window->UpdateDevTools(); 552 inspected_window->UpdateDevTools();
553 main_web_contents_->SetInitialFocus(); 553 main_web_contents_->SetInitialFocus();
554 inspected_window->Show(); 554 inspected_window->Show(true /* user_gesture */);
555 // On Aura, focusing once is not enough. Do it again. 555 // On Aura, focusing once is not enough. Do it again.
556 // Note that focusing only here but not before isn't enough either. We just 556 // Note that focusing only here but not before isn't enough either. We just
557 // need to focus twice. 557 // need to focus twice.
558 main_web_contents_->SetInitialFocus(); 558 main_web_contents_->SetInitialFocus();
559 559
560 PrefsTabHelper::CreateForWebContents(main_web_contents_); 560 PrefsTabHelper::CreateForWebContents(main_web_contents_);
561 main_web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 561 main_web_contents_->GetRenderViewHost()->SyncRendererPrefs();
562 562
563 DoAction(action); 563 DoAction(action);
564 return; 564 return;
565 } 565 }
566 566
567 // Avoid consecutive window switching if the devtools window has been opened 567 // Avoid consecutive window switching if the devtools window has been opened
568 // and the Inspect Element shortcut is pressed in the inspected tab. 568 // and the Inspect Element shortcut is pressed in the inspected tab.
569 bool should_show_window = 569 bool should_show_window =
570 !browser_ || (action.type() != DevToolsToggleAction::kInspect); 570 !browser_ || (action.type() != DevToolsToggleAction::kInspect);
571 571
572 if (!browser_) 572 if (!browser_)
573 CreateDevToolsBrowser(); 573 CreateDevToolsBrowser();
574 574
575 if (should_show_window) { 575 if (should_show_window) {
576 browser_->window()->Show(); 576 browser_->window()->Show(true /* user_gesture */);
577 main_web_contents_->SetInitialFocus(); 577 main_web_contents_->SetInitialFocus();
578 } 578 }
579 if (toolbox_web_contents_) 579 if (toolbox_web_contents_)
580 UpdateBrowserWindow(); 580 UpdateBrowserWindow();
581 581
582 DoAction(action); 582 DoAction(action);
583 } 583 }
584 584
585 // static 585 // static
586 bool DevToolsWindow::HandleBeforeUnload(WebContents* frontend_contents, 586 bool DevToolsWindow::HandleBeforeUnload(WebContents* frontend_contents,
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 closure.Run(); 1205 closure.Run();
1206 return; 1206 return;
1207 } 1207 }
1208 load_completed_callback_ = closure; 1208 load_completed_callback_ = closure;
1209 } 1209 }
1210 1210
1211 bool DevToolsWindow::ForwardKeyboardEvent( 1211 bool DevToolsWindow::ForwardKeyboardEvent(
1212 const content::NativeWebKeyboardEvent& event) { 1212 const content::NativeWebKeyboardEvent& event) {
1213 return event_forwarder_->ForwardEvent(event); 1213 return event_forwarder_->ForwardEvent(event);
1214 } 1214 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698