| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/location_bar/location_bar.h" | 5 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 6 | 6 |
| 7 #include "base/scoped_observer.h" | 7 #include "base/scoped_observer.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 void OnExtensionLoaded(content::BrowserContext* browser_context, | 31 void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 32 const extensions::Extension* extension) override { | 32 const extensions::Extension* extension) override { |
| 33 if (extensions::UIOverrides::RemovesBookmarkButton(extension)) | 33 if (extensions::UIOverrides::RemovesBookmarkButton(extension)) |
| 34 location_bar_->UpdateBookmarkStarVisibility(); | 34 location_bar_->UpdateBookmarkStarVisibility(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void OnExtensionUnloaded( | 37 void OnExtensionUnloaded( |
| 38 content::BrowserContext* browser_context, | 38 content::BrowserContext* browser_context, |
| 39 const extensions::Extension* extension, | 39 const extensions::Extension* extension, |
| 40 extensions::UnloadedExtensionInfo::Reason reason) override { | 40 extensions::UnloadedExtensionReason reason) override { |
| 41 if (extensions::UIOverrides::RemovesBookmarkButton(extension)) | 41 if (extensions::UIOverrides::RemovesBookmarkButton(extension)) |
| 42 location_bar_->UpdateBookmarkStarVisibility(); | 42 location_bar_->UpdateBookmarkStarVisibility(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 // The location bar that owns this object (thus always safe to use). | 46 // The location bar that owns this object (thus always safe to use). |
| 47 LocationBar* const location_bar_; | 47 LocationBar* const location_bar_; |
| 48 | 48 |
| 49 ScopedObserver<extensions::ExtensionRegistry, | 49 ScopedObserver<extensions::ExtensionRegistry, |
| 50 extensions::ExtensionRegistryObserver> | 50 extensions::ExtensionRegistryObserver> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 content::BrowserContext* browser_context = web_contents->GetBrowserContext(); | 93 content::BrowserContext* browser_context = web_contents->GetBrowserContext(); |
| 94 extensions::ExtensionRegistry* extension_registry = | 94 extensions::ExtensionRegistry* extension_registry = |
| 95 extensions::ExtensionRegistry::Get(browser_context); | 95 extensions::ExtensionRegistry::Get(browser_context); |
| 96 const extensions::Extension* extension = | 96 const extensions::Extension* extension = |
| 97 extension_registry->enabled_extensions().GetByID(url.host()); | 97 extension_registry->enabled_extensions().GetByID(url.host()); |
| 98 return extension ? base::CollapseWhitespace( | 98 return extension ? base::CollapseWhitespace( |
| 99 base::UTF8ToUTF16(extension->name()), false) | 99 base::UTF8ToUTF16(extension->name()), false) |
| 100 : base::string16(); | 100 : base::string16(); |
| 101 } | 101 } |
| OLD | NEW |