Index: chrome/browser/ui/apps/chrome_shell_window_delegate.cc |
diff --git a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc |
index 255c416f76c8b8b0604f6f13ce7645c6caf68912..2ed133330948cc0e3c5af5560ed8bcdc77762728 100644 |
--- a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc |
+++ b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc |
@@ -29,20 +29,12 @@ namespace { |
bool disable_external_open_for_testing_ = false; |
-class ShellWindowLinkDelegate : public content::WebContentsDelegate { |
- public: |
- ShellWindowLinkDelegate(); |
- |
- private: |
- virtual content::WebContents* OpenURLFromTab( |
- content::WebContents* source, |
- const content::OpenURLParams& params) OVERRIDE; |
- |
- DISALLOW_COPY_AND_ASSIGN(ShellWindowLinkDelegate); |
-}; |
+} // namespace |
ShellWindowLinkDelegate::ShellWindowLinkDelegate() {} |
+ShellWindowLinkDelegate::~ShellWindowLinkDelegate() {} |
+ |
// TODO(rockot): Add a test that exercises this code. See |
// http://crbug.com/254260. |
content::WebContents* ShellWindowLinkDelegate::OpenURLFromTab( |
@@ -53,8 +45,6 @@ content::WebContents* ShellWindowLinkDelegate::OpenURLFromTab( |
return NULL; |
} |
-} // namespace |
- |
ChromeShellWindowDelegate::ChromeShellWindowDelegate() {} |
ChromeShellWindowDelegate::~ChromeShellWindowDelegate() {} |
@@ -92,7 +82,9 @@ void ChromeShellWindowDelegate::AddNewContents( |
bool user_gesture, |
bool* was_blocked) { |
if (!disable_external_open_for_testing_) { |
- new_contents->SetDelegate(new ShellWindowLinkDelegate()); |
+ if (!shell_window_link_delegate_.get()) |
+ shell_window_link_delegate_.reset(new ShellWindowLinkDelegate()); |
+ new_contents->SetDelegate(shell_window_link_delegate_.get()); |
return; |
} |
Browser* browser = |