1 // Copyright 2013 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.
5 #include "chrome/browser/ui/search/instant_ipc_sender.h"
7 #include "chrome/common/render_messages.h"
11 // Implementation for regular profiles.
12 class InstantIPCSenderImpl
: public InstantIPCSender
{
14 InstantIPCSenderImpl() {}
15 virtual ~InstantIPCSenderImpl() {}
18 virtual void FocusChanged(OmniboxFocusState state
,
19 OmniboxFocusChangeReason reason
) OVERRIDE
{
20 Send(new ChromeViewMsg_SearchBoxFocusChanged(routing_id(), state
, reason
));
23 virtual void SetInputInProgress(bool input_in_progress
) OVERRIDE
{
24 Send(new ChromeViewMsg_SearchBoxSetInputInProgress(
25 routing_id(), input_in_progress
));
28 DISALLOW_COPY_AND_ASSIGN(InstantIPCSenderImpl
);
31 // Implementation for incognito profiles.
32 class IncognitoInstantIPCSenderImpl
: public InstantIPCSender
{
34 IncognitoInstantIPCSenderImpl() {}
35 virtual ~IncognitoInstantIPCSenderImpl() {}
38 DISALLOW_COPY_AND_ASSIGN(IncognitoInstantIPCSenderImpl
);
41 } // anonymous namespace
44 scoped_ptr
<InstantIPCSender
> InstantIPCSender::Create(bool is_incognito
) {
45 scoped_ptr
<InstantIPCSender
> sender(
47 static_cast<InstantIPCSender
*>(new IncognitoInstantIPCSenderImpl()) :
48 static_cast<InstantIPCSender
*>(new InstantIPCSenderImpl()));
52 void InstantIPCSender::SetContents(content::WebContents
* web_contents
) {
53 Observe(web_contents
);