OLD | NEW |
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/macros.h" | 10 #include "base/macros.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 class ScopedBrowserShower { | 294 class ScopedBrowserShower { |
295 public: | 295 public: |
296 explicit ScopedBrowserShower(chrome::NavigateParams* params) | 296 explicit ScopedBrowserShower(chrome::NavigateParams* params) |
297 : params_(params) { | 297 : params_(params) { |
298 } | 298 } |
299 ~ScopedBrowserShower() { | 299 ~ScopedBrowserShower() { |
300 if (params_->window_action == | 300 if (params_->window_action == |
301 chrome::NavigateParams::SHOW_WINDOW_INACTIVE) { | 301 chrome::NavigateParams::SHOW_WINDOW_INACTIVE) { |
302 params_->browser->window()->ShowInactive(); | 302 params_->browser->window()->ShowInactive(); |
303 } else if (params_->window_action == chrome::NavigateParams::SHOW_WINDOW) { | 303 } else if (params_->window_action == chrome::NavigateParams::SHOW_WINDOW) { |
304 params_->browser->window()->Show(); | 304 BrowserWindow* window = params_->browser->window(); |
| 305 window->Show(); |
305 // If a user gesture opened a popup window, focus the contents. | 306 // If a user gesture opened a popup window, focus the contents. |
306 if (params_->user_gesture && | 307 if (params_->user_gesture && |
307 params_->disposition == WindowOpenDisposition::NEW_POPUP && | 308 params_->disposition == WindowOpenDisposition::NEW_POPUP && |
308 params_->target_contents) { | 309 params_->target_contents) { |
309 params_->target_contents->Focus(); | 310 params_->target_contents->Focus(); |
| 311 window->Activate(); |
310 } | 312 } |
311 } | 313 } |
312 } | 314 } |
313 | 315 |
314 private: | 316 private: |
315 chrome::NavigateParams* params_; | 317 chrome::NavigateParams* params_; |
316 DISALLOW_COPY_AND_ASSIGN(ScopedBrowserShower); | 318 DISALLOW_COPY_AND_ASSIGN(ScopedBrowserShower); |
317 }; | 319 }; |
318 | 320 |
319 // This class manages the lifetime of a WebContents created by the | 321 // This class manages the lifetime of a WebContents created by the |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 bool reverse_on_redirect = false; | 673 bool reverse_on_redirect = false; |
672 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 674 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
673 &rewritten_url, browser_context, &reverse_on_redirect); | 675 &rewritten_url, browser_context, &reverse_on_redirect); |
674 | 676 |
675 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 677 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
676 return !(rewritten_url.scheme_piece() == content::kChromeUIScheme && | 678 return !(rewritten_url.scheme_piece() == content::kChromeUIScheme && |
677 rewritten_url.host_piece() == chrome::kChromeUIUberHost); | 679 rewritten_url.host_piece() == chrome::kChromeUIUberHost); |
678 } | 680 } |
679 | 681 |
680 } // namespace chrome | 682 } // namespace chrome |
OLD | NEW |