Home | History | Annotate | Download | only in instant
      1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_
      6 #define CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_
      7 #pragma once
      8 
      9 #include "base/string16.h"
     10 #include "chrome/common/instant_types.h"
     11 
     12 class TabContentsWrapper;
     13 
     14 namespace gfx {
     15 class Rect;
     16 }
     17 
     18 // InstantController's delegate. Normally the Browser implements this. See
     19 // InstantController for details.
     20 class InstantDelegate {
     21  public:
     22   // Invoked when instant starts loading, but before the preview tab contents is
     23   // ready to be shown. This may be used to animate between the states.
     24   // This is followed by ShowInstant and/or HideInstant.
     25   virtual void PrepareForInstant() = 0;
     26 
     27   // Invoked when the instant TabContents should be shown.
     28   virtual void ShowInstant(TabContentsWrapper* preview_contents) = 0;
     29 
     30   // Invoked when the instant TabContents should be hidden. Instant still may be
     31   // active at the time this is invoked. Use |is_active()| to determine if
     32   // instant is still active.
     33   virtual void HideInstant() = 0;
     34 
     35   // Invoked when the user does something that should result in the preview
     36   // TabContents becoming the active TabContents. The delegate takes ownership
     37   // of the supplied TabContents.
     38   virtual void CommitInstant(TabContentsWrapper* preview_contents) = 0;
     39 
     40   // Invoked when the suggested text is to change to |text|.
     41   virtual void SetSuggestedText(const string16& text,
     42                                 InstantCompleteBehavior behavior) = 0;
     43 
     44   // Returns the bounds instant will be placed at in screen coordinates.
     45   virtual gfx::Rect GetInstantBounds() = 0;
     46 
     47  protected:
     48   virtual ~InstantDelegate() {}
     49 };
     50 
     51 #endif  // CHROME_BROWSER_INSTANT_INSTANT_DELEGATE_H_
     52