Chromium Code Reviews| 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..8bee0518d52390c25ed88d93f2e6d96590eb4bb0 100644 |
| --- a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc |
| +++ b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc |
| @@ -29,17 +29,7 @@ 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() {} |
| @@ -53,8 +43,6 @@ content::WebContents* ShellWindowLinkDelegate::OpenURLFromTab( |
| return NULL; |
| } |
| -} // namespace |
| - |
| ChromeShellWindowDelegate::ChromeShellWindowDelegate() {} |
| ChromeShellWindowDelegate::~ChromeShellWindowDelegate() {} |
| @@ -92,7 +80,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()); |
|
sky
2013/07/08 14:51:39
What is the lifetime of new_contents?
zhchbin
2013/07/09 02:00:10
It will be deleted when the ShellWindowLinkDelegat
|
| return; |
| } |
| Browser* browser = |