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

Side by Side Diff: chrome/browser/ui/browser_navigator.cc

Issue 599763003: Focus the contents of popup windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/ui/browser_navigator.h" 5 #include "chrome/browser/ui/browser_navigator.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/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 // This class makes sure the Browser object held in |params| is made visible 287 // This class makes sure the Browser object held in |params| is made visible
288 // by the time it goes out of scope, provided |params| wants it to be shown. 288 // by the time it goes out of scope, provided |params| wants it to be shown.
289 class ScopedBrowserShower { 289 class ScopedBrowserShower {
290 public: 290 public:
291 explicit ScopedBrowserShower(chrome::NavigateParams* params) 291 explicit ScopedBrowserShower(chrome::NavigateParams* params)
292 : params_(params) { 292 : params_(params) {
293 } 293 }
294 ~ScopedBrowserShower() { 294 ~ScopedBrowserShower() {
295 if (params_->window_action == chrome::NavigateParams::SHOW_WINDOW_INACTIVE) 295 if (params_->window_action ==
296 chrome::NavigateParams::SHOW_WINDOW_INACTIVE) {
296 params_->browser->window()->ShowInactive(); 297 params_->browser->window()->ShowInactive();
297 else if (params_->window_action == chrome::NavigateParams::SHOW_WINDOW) 298 } else if (params_->window_action == chrome::NavigateParams::SHOW_WINDOW) {
298 params_->browser->window()->Show(); 299 params_->browser->window()->Show();
300 // If a user gesture opened a popup window, focus the contents.
301 if (params_->user_gesture && params_->disposition == NEW_POPUP &&
302 params_->target_contents) {
303 params_->target_contents->Focus();
304 }
305 }
299 } 306 }
307
300 private: 308 private:
301 chrome::NavigateParams* params_; 309 chrome::NavigateParams* params_;
302 DISALLOW_COPY_AND_ASSIGN(ScopedBrowserShower); 310 DISALLOW_COPY_AND_ASSIGN(ScopedBrowserShower);
303 }; 311 };
304 312
305 // This class manages the lifetime of a WebContents created by the 313 // This class manages the lifetime of a WebContents created by the
306 // Navigate() function. When Navigate() creates a WebContents for a URL, 314 // Navigate() function. When Navigate() creates a WebContents for a URL,
307 // an instance of this class takes ownership of it via TakeOwnership() until the 315 // an instance of this class takes ownership of it via TakeOwnership() until the
308 // WebContents is added to a tab strip at which time ownership is 316 // WebContents is added to a tab strip at which time ownership is
309 // relinquished via ReleaseOwnership(). If this object goes out of scope without 317 // relinquished via ReleaseOwnership(). If this object goes out of scope without
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 bool reverse_on_redirect = false; 765 bool reverse_on_redirect = false;
758 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 766 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
759 &rewritten_url, browser_context, &reverse_on_redirect); 767 &rewritten_url, browser_context, &reverse_on_redirect);
760 768
761 // Some URLs are mapped to uber subpages. Do not allow them in incognito. 769 // Some URLs are mapped to uber subpages. Do not allow them in incognito.
762 return !(rewritten_url.scheme() == content::kChromeUIScheme && 770 return !(rewritten_url.scheme() == content::kChromeUIScheme &&
763 rewritten_url.host() == chrome::kChromeUIUberHost); 771 rewritten_url.host() == chrome::kChromeUIUberHost);
764 } 772 }
765 773
766 } // namespace chrome 774 } // namespace chrome
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