| 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/media_galleries/media_file_system_registry.h" | 5 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void ReferenceFromRVH(const content::RenderViewHost* rvh); | 78 void ReferenceFromRVH(const content::RenderViewHost* rvh); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 class RPHWebContentsObserver : public content::WebContentsObserver { | 81 class RPHWebContentsObserver : public content::WebContentsObserver { |
| 82 public: | 82 public: |
| 83 RPHWebContentsObserver(RPHReferenceManager* manager, | 83 RPHWebContentsObserver(RPHReferenceManager* manager, |
| 84 WebContents* web_contents); | 84 WebContents* web_contents); |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 // content::WebContentsObserver | 87 // content::WebContentsObserver |
| 88 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; | 88 virtual void WebContentsDestroyed() OVERRIDE; |
| 89 virtual void NavigationEntryCommitted( | 89 virtual void NavigationEntryCommitted( |
| 90 const content::LoadCommittedDetails& load_details) OVERRIDE; | 90 const content::LoadCommittedDetails& load_details) OVERRIDE; |
| 91 | 91 |
| 92 RPHReferenceManager* manager_; | 92 RPHReferenceManager* manager_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 class RPHObserver : public content::RenderProcessHostObserver { | 95 class RPHObserver : public content::RenderProcessHostObserver { |
| 96 public: | 96 public: |
| 97 RPHObserver(RPHReferenceManager* manager, RenderProcessHost* host); | 97 RPHObserver(RPHReferenceManager* manager, RenderProcessHost* host); |
| 98 virtual ~RPHObserver(); | 98 virtual ~RPHObserver(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 state->AddWebContentsObserver(contents); | 148 state->AddWebContentsObserver(contents); |
| 149 } | 149 } |
| 150 | 150 |
| 151 RPHReferenceManager::RPHWebContentsObserver::RPHWebContentsObserver( | 151 RPHReferenceManager::RPHWebContentsObserver::RPHWebContentsObserver( |
| 152 RPHReferenceManager* manager, | 152 RPHReferenceManager* manager, |
| 153 WebContents* web_contents) | 153 WebContents* web_contents) |
| 154 : content::WebContentsObserver(web_contents), | 154 : content::WebContentsObserver(web_contents), |
| 155 manager_(manager) { | 155 manager_(manager) { |
| 156 } | 156 } |
| 157 | 157 |
| 158 void RPHReferenceManager::RPHWebContentsObserver::WebContentsDestroyed( | 158 void RPHReferenceManager::RPHWebContentsObserver::WebContentsDestroyed() { |
| 159 WebContents* web_contents) { | 159 manager_->OnWebContentsDestroyedOrNavigated(web_contents()); |
| 160 manager_->OnWebContentsDestroyedOrNavigated(web_contents); | |
| 161 } | 160 } |
| 162 | 161 |
| 163 void RPHReferenceManager::RPHWebContentsObserver::NavigationEntryCommitted( | 162 void RPHReferenceManager::RPHWebContentsObserver::NavigationEntryCommitted( |
| 164 const content::LoadCommittedDetails& load_details) { | 163 const content::LoadCommittedDetails& load_details) { |
| 165 if (load_details.is_in_page) | 164 if (load_details.is_in_page) |
| 166 return; | 165 return; |
| 167 | 166 |
| 168 manager_->OnWebContentsDestroyedOrNavigated(web_contents()); | 167 manager_->OnWebContentsDestroyedOrNavigated(web_contents()); |
| 169 } | 168 } |
| 170 | 169 |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 DCHECK_EQ(1U, erase_count); | 826 DCHECK_EQ(1U, erase_count); |
| 828 if (extension_hosts->second.empty()) { | 827 if (extension_hosts->second.empty()) { |
| 829 // When a profile has no ExtensionGalleriesHosts left, remove the | 828 // When a profile has no ExtensionGalleriesHosts left, remove the |
| 830 // matching gallery-change-watcher since it is no longer needed. Leave the | 829 // matching gallery-change-watcher since it is no longer needed. Leave the |
| 831 // |extension_hosts| entry alone, since it indicates the profile has been | 830 // |extension_hosts| entry alone, since it indicates the profile has been |
| 832 // previously used. | 831 // previously used. |
| 833 MediaGalleriesPreferences* preferences = GetPreferences(profile); | 832 MediaGalleriesPreferences* preferences = GetPreferences(profile); |
| 834 preferences->RemoveGalleryChangeObserver(this); | 833 preferences->RemoveGalleryChangeObserver(this); |
| 835 } | 834 } |
| 836 } | 835 } |
| OLD | NEW |