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/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
6 | 6 |
7 #include "apps/shell_window_geometry_cache.h" | 7 #include "apps/shell_window_geometry_cache.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/app_window_contents.h" | 10 #include "chrome/browser/extensions/app_window_contents.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 void ShellWindow::AddNewContents(WebContents* source, | 311 void ShellWindow::AddNewContents(WebContents* source, |
312 WebContents* new_contents, | 312 WebContents* new_contents, |
313 WindowOpenDisposition disposition, | 313 WindowOpenDisposition disposition, |
314 const gfx::Rect& initial_pos, | 314 const gfx::Rect& initial_pos, |
315 bool user_gesture, | 315 bool user_gesture, |
316 bool* was_blocked) { | 316 bool* was_blocked) { |
317 DCHECK(Profile::FromBrowserContext(new_contents->GetBrowserContext()) == | 317 DCHECK(Profile::FromBrowserContext(new_contents->GetBrowserContext()) == |
318 profile_); | 318 profile_); |
319 #if defined(OS_MACOSX) || defined(OS_WIN) || \ | 319 #if defined(OS_MACOSX) || defined(OS_WIN) || \ |
320 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 320 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
321 if (disable_external_open_for_testing_) { | 321 if (disable_external_open_for_testing_) { |
zhchbin
2013/07/01 06:24:39
Can we remove this "disable_external_open_for_test
| |
322 Browser* browser = | 322 Browser* browser = |
323 chrome::FindOrCreateTabbedBrowser(profile_, chrome::GetActiveDesktop()); | 323 chrome::FindOrCreateTabbedBrowser(profile_, chrome::GetActiveDesktop()); |
324 // Force all links to open in a new tab, even if they were trying to open a | 324 // Force all links to open in a new tab, even if they were trying to open a |
325 // new window. | 325 // new window. |
326 disposition = | 326 disposition = |
327 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; | 327 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; |
328 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 328 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
329 initial_pos, user_gesture, was_blocked); | 329 initial_pos, user_gesture, was_blocked); |
330 } else { | 330 } else { |
331 new_contents->SetDelegate(new ShellWindowLinkDelegate()); | 331 new_contents->SetDelegate(new ShellWindowLinkDelegate()); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
690 sk_region->op( | 690 sk_region->op( |
691 region.bounds.x(), | 691 region.bounds.x(), |
692 region.bounds.y(), | 692 region.bounds.y(), |
693 region.bounds.right(), | 693 region.bounds.right(), |
694 region.bounds.bottom(), | 694 region.bounds.bottom(), |
695 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 695 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
696 } | 696 } |
697 return sk_region; | 697 return sk_region; |
698 } | 698 } |
699 | 699 |
700 // static | |
700 void ShellWindow::DisableExternalOpenForTesting() { | 701 void ShellWindow::DisableExternalOpenForTesting() { |
701 disable_external_open_for_testing_ = true; | 702 disable_external_open_for_testing_ = true; |
702 } | 703 } |
703 | 704 |
705 // static | |
706 void ShellWindow::EnableExternalOpenForTesting() { | |
707 disable_external_open_for_testing_ = false; | |
708 } | |
OLD | NEW |