NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / search / instant_ipc_sender.cc
blob22c2120244a445f4559aa1707ee9d0ea693dbee0
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"
9 namespace {
11 // Implementation for regular profiles.
12 class InstantIPCSenderImpl : public InstantIPCSender {
13 public:
14 InstantIPCSenderImpl() {}
15 virtual ~InstantIPCSenderImpl() {}
17 private:
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 {
33 public:
34 IncognitoInstantIPCSenderImpl() {}
35 virtual ~IncognitoInstantIPCSenderImpl() {}
37 private:
38 DISALLOW_COPY_AND_ASSIGN(IncognitoInstantIPCSenderImpl);
41 } // anonymous namespace
43 // static
44 scoped_ptr<InstantIPCSender> InstantIPCSender::Create(bool is_incognito) {
45 scoped_ptr<InstantIPCSender> sender(
46 is_incognito ?
47 static_cast<InstantIPCSender*>(new IncognitoInstantIPCSenderImpl()) :
48 static_cast<InstantIPCSender*>(new InstantIPCSenderImpl()));
49 return sender.Pass();
52 void InstantIPCSender::SetContents(content::WebContents* web_contents) {
53 Observe(web_contents);