// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_ #define EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_ #include <map> #include <memory> #include <set> #include "base/lazy_instance.h" #include "base/unguessable_token.h" #include "base/uuid.h" #include "content/public/browser/document_user_data.h" #include "content/public/browser/frame_type.h" #include "content/public/browser/global_routing_id.h" #include "extensions/common/api/extension_types.h" namespace content { class NavigationHandle; class RenderFrameHost; class WebContents; } // namespace content namespace extensions { // Extension frame IDs are exposed through the chrome.* APIs and have the // following characteristics: // - The top-level frame has ID 0. // - Any child frame has a positive ID. // - A non-existent frame has ID -1. // - They are only guaranteed to be unique within a tab. // - The ID does not change during the frame's lifetime and is not re-used after // the frame is removed. The frame may change its current RenderFrameHost over // time, so multiple RenderFrameHosts may map to the same extension frame ID. // // This class provides a mapping from a (render_process_id, frame_routing_id) // pair to a FrameData struct, which includes the extension's frame id (as // described above), the parent frame id, and the tab id (the latter can be // invalid if it's not in a tab). // // Unless stated otherwise, the methods can only be called on the UI thread. // // The non-static methods of this class use an internal cache. class ExtensionApiFrameIdMap { … }; } // namespace extensions #endif // EXTENSIONS_BROWSER_EXTENSION_API_FRAME_ID_MAP_H_