| 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/extensions/menu_manager.h" | 5 #include "chrome/browser/extensions/menu_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 Profile* profile = content::Source<Profile>(source).ptr(); | 865 Profile* profile = content::Source<Profile>(source).ptr(); |
| 866 // We cannot use profile_->HasOffTheRecordProfile as it may already be | 866 // We cannot use profile_->HasOffTheRecordProfile as it may already be |
| 867 // false at this point, if for example the incognito profile was destroyed | 867 // false at this point, if for example the incognito profile was destroyed |
| 868 // using DestroyOffTheRecordProfile. | 868 // using DestroyOffTheRecordProfile. |
| 869 if (profile->GetOriginalProfile() == browser_context_ && | 869 if (profile->GetOriginalProfile() == browser_context_ && |
| 870 profile->GetOriginalProfile() != profile) { | 870 profile->GetOriginalProfile() != profile) { |
| 871 RemoveAllIncognitoContextItems(); | 871 RemoveAllIncognitoContextItems(); |
| 872 } | 872 } |
| 873 } | 873 } |
| 874 | 874 |
| 875 const SkBitmap& MenuManager::GetIconForExtension( | 875 gfx::Image MenuManager::GetIconForExtension(const std::string& extension_id) { |
| 876 const std::string& extension_id) { | |
| 877 return icon_manager_.GetIcon(extension_id); | 876 return icon_manager_.GetIcon(extension_id); |
| 878 } | 877 } |
| 879 | 878 |
| 880 void MenuManager::RemoveAllIncognitoContextItems() { | 879 void MenuManager::RemoveAllIncognitoContextItems() { |
| 881 // Get all context menu items with "incognito" set to "split". | 880 // Get all context menu items with "incognito" set to "split". |
| 882 std::set<MenuItem::Id> items_to_remove; | 881 std::set<MenuItem::Id> items_to_remove; |
| 883 for (auto iter = items_by_id_.begin(); iter != items_by_id_.end(); ++iter) { | 882 for (auto iter = items_by_id_.begin(); iter != items_by_id_.end(); ++iter) { |
| 884 if (iter->first.incognito) | 883 if (iter->first.incognito) |
| 885 items_to_remove.insert(iter->first); | 884 items_to_remove.insert(iter->first); |
| 886 } | 885 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 bool MenuItem::Id::operator!=(const Id& other) const { | 964 bool MenuItem::Id::operator!=(const Id& other) const { |
| 966 return !(*this == other); | 965 return !(*this == other); |
| 967 } | 966 } |
| 968 | 967 |
| 969 bool MenuItem::Id::operator<(const Id& other) const { | 968 bool MenuItem::Id::operator<(const Id& other) const { |
| 970 return std::tie(incognito, extension_key, uid, string_uid) < | 969 return std::tie(incognito, extension_key, uid, string_uid) < |
| 971 std::tie(other.incognito, other.extension_key, other.uid, other.string_uid); | 970 std::tie(other.incognito, other.extension_key, other.uid, other.string_uid); |
| 972 } | 971 } |
| 973 | 972 |
| 974 } // namespace extensions | 973 } // namespace extensions |
| OLD | NEW |