#include "base/atomic_ref_count.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/chromeos/login/merge_session_load_page.h"
#include "content/public/browser/resource_throttle.h"
#include "net/base/completion_callback.h"
+#include "webkit/common/resource_type.h"
class Profile;
: public content::ResourceThrottle,
public base::SupportsWeakPtr<MergeSessionThrottle> {
public:
- explicit MergeSessionThrottle(net::URLRequest* request);
+ // Passed a boolean indicating whether or not it is OK to proceed with the
+ // page load.
+ typedef base::Closure CompletionCallback;
+
+ explicit MergeSessionThrottle(net::URLRequest* request,
+ ResourceType::Type resource_type);
virtual ~MergeSessionThrottle();
// content::ResourceThrottle implementation:
void ClearRequestInfo();
bool IsRemote(const GURL& url) const;
- // True if we should show the merge session in progress page. The function
+ // True if we |url| loading should be delayed. The function
// is safe to be called on any thread.
- bool ShouldShowMergeSessionPage(const GURL& url) const;
+ bool ShouldDelayUrl(const GURL& url) const;
// Adds/removes |profile| to/from the blocking profiles set.
static void BlockProfile(Profile* profile);
static void UnblockProfile(Profile* profile);
- // Helper method that checks if we should show interstitial page based on
+ // Helper method that checks if we should delay reasource loading based on
// the state of the Profile that's derived from |render_process_id| and
// |render_view_id|.
- static bool ShouldShowInterstitialPage(int render_process_id,
- int render_view_id);
+ static bool ShouldDelayRequest(int render_process_id,
+ int render_view_id);
- // Tests merge session status and if needed shows interstitial page.
+ // Tests merge session status and if needed generates request
+ // waiter (for ResourceType::XHR content) or shows interstitial page
+ // (for ResourceType::MAIN_FRAME).
// The function must be called from UI thread.
- static void ShowDeleayedLoadingPageOnUIThread(
+ static void DeleayResourceLoadingOnUIThread(
+ ResourceType::Type resource_type,
int render_process_id,
int render_view_id,
const GURL& url,
- const chromeos::MergeSessionLoadPage::CompletionCallback& callback);
+ const MergeSessionThrottle::CompletionCallback& callback);
net::URLRequest* request_;
+ ResourceType::Type resource_type_;
// Global counter that keeps the track of session merge status for all
// encountered profiles. This is used to determine if a throttle should