| Index: extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher_group.h
|
| diff --git a/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher_group.h b/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher_group.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c55b5d3ac8311110dc5553db29c6798fc7ef83f4
|
| --- /dev/null
|
| +++ b/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher_group.h
|
| @@ -0,0 +1,57 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef EXTENSIONS_BROWSER_WEB_UI_URL_FETCHER_GROUP_H
|
| +#define EXTENSIONS_BROWSER_WEB_UI_URL_FETCHER_GROUP_H
|
| +
|
| +#include <set>
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_vector.h"
|
| +#include "extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h"
|
| +#include "extensions/common/user_script.h"
|
| +
|
| +namespace content {
|
| +class BrowserContext;
|
| +}
|
| +
|
| +// WebUIURLFetcherGroup receives a set of user script file load tasks, and
|
| +// starts a group of async URL fetchs. When all the fetches are done, it runs
|
| +// the callback from the owner of the group.
|
| +class WebUIURLFetcherGroup : public base::RefCounted<WebUIURLFetcherGroup> {
|
| + public:
|
| + WebUIURLFetcherGroup(content::BrowserContext* context,
|
| + const base::Closure& callback);
|
| +
|
| + // Starts URL requests to load the contents of several files from the
|
| + // associated render specified by |render_process_id, render_view_id|.
|
| + void Start(std::set<extensions::UserScript::File*> file_set,
|
| + int render_process_id,
|
| + int render_view_id);
|
| +
|
| + private:
|
| + friend class base::RefCounted<WebUIURLFetcherGroup>;
|
| +
|
| + virtual ~WebUIURLFetcherGroup();
|
| +
|
| + // Called when each single URL fetch is complete. It also traces the number of
|
| + // complete fetches. If all the fetches are done, runs the callback function
|
| + // from the owner of this group.
|
| + void OnWebUIURLFetchComplete(extensions::UserScript::File* script_file,
|
| + bool success,
|
| + const std::string& data);
|
| +
|
| + content::BrowserContext* context_;
|
| +
|
| + // The number of complete fetchs.
|
| + size_t complete_fetchers_;
|
| +
|
| + ScopedVector<WebUIURLFetcher> fetchers_;
|
| + base::Closure callback_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WebUIURLFetcherGroup);
|
| +};
|
| +
|
| +#endif // EXTENSIONS_BROWSER_WEB_UI_URL_FETCHER_GROUP_H
|
|
|