| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/file_manager/app_installer.h" | 5 #include "chrome/browser/chromeos/file_manager/app_installer.h" |
| 6 | 6 |
| 7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
| 8 | 8 |
| 9 class Profile; | 9 class Profile; |
| 10 | 10 |
| 11 namespace file_manager { | 11 namespace file_manager { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 const char kWebContentsDestroyedError[] = "WebContents is destroyed."; | 14 const char kWebContentsDestroyedError[] = "WebContents is destroyed."; |
| 15 } // namespace | 15 } // namespace |
| 16 | 16 |
| 17 class AppInstaller::WebContentsObserver | 17 class AppInstaller::WebContentsObserver |
| 18 : public content::WebContentsObserver { | 18 : public content::WebContentsObserver { |
| 19 | 19 |
| 20 public: | 20 public: |
| 21 explicit WebContentsObserver( | 21 explicit WebContentsObserver( |
| 22 content::WebContents* web_contents, | 22 content::WebContents* web_contents, |
| 23 AppInstaller* parent) | 23 AppInstaller* parent) |
| 24 : content::WebContentsObserver(web_contents), | 24 : content::WebContentsObserver(web_contents), |
| 25 parent_(parent) { | 25 parent_(parent) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 protected: | 28 protected: |
| 29 // content::WebContentsObserver implementation. | 29 // content::WebContentsObserver implementation. |
| 30 virtual void WebContentsDestroyed( | 30 virtual void WebContentsDestroyed() OVERRIDE { |
| 31 content::WebContents* web_contents) OVERRIDE { | 31 parent_->OnWebContentsDestroyed(web_contents()); |
| 32 parent_->OnWebContentsDestroyed(web_contents); | |
| 33 } | 32 } |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 AppInstaller* parent_; | 35 AppInstaller* parent_; |
| 37 | 36 |
| 38 DISALLOW_IMPLICIT_CONSTRUCTORS(WebContentsObserver); | 37 DISALLOW_IMPLICIT_CONSTRUCTORS(WebContentsObserver); |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 AppInstaller::AppInstaller( | 40 AppInstaller::AppInstaller( |
| 42 content::WebContents* web_contents, | 41 content::WebContents* web_contents, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 return true; | 103 return true; |
| 105 } | 104 } |
| 106 | 105 |
| 107 void AppInstaller::OnWebContentsDestroyed( | 106 void AppInstaller::OnWebContentsDestroyed( |
| 108 content::WebContents* web_contents) { | 107 content::WebContents* web_contents) { |
| 109 callback_.Run(false, kWebContentsDestroyedError); | 108 callback_.Run(false, kWebContentsDestroyedError); |
| 110 AbortInstall(); | 109 AbortInstall(); |
| 111 } | 110 } |
| 112 | 111 |
| 113 } // namespace file_manager | 112 } // namespace file_manager |
| OLD | NEW |