Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: chrome/browser/ui/webui/ntp/android/new_tab_page_ready_handler.cc

Issue 11038014: [Android] Upstream remaining changes to NTP UI code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed indentation nit Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/ntp/android/new_tab_page_ready_handler.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "base/values.h"
10 #include "chrome/common/chrome_notification_types.h"
11 #include "content/public/browser/notification_service.h"
12 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_ui.h"
14
15 NewTabPageReadyHandler::NewTabPageReadyHandler() {
16 }
17
18 NewTabPageReadyHandler::~NewTabPageReadyHandler() {
19 }
20
21 void NewTabPageReadyHandler::RegisterMessages() {
22 web_ui()->RegisterMessageCallback("notifyNTPReady", base::Bind(
23 &NewTabPageReadyHandler::HandleNewTabPageReady, base::Unretained(this)));
24 web_ui()->RegisterMessageCallback("NTPUnexpectedNavigation", base::Bind(
25 &NewTabPageReadyHandler::HandleNewTabPageUnexpectedNavigation,
26 base::Unretained(this)));
27 }
28
29 void NewTabPageReadyHandler::HandleNewTabPageReady(
30 const ListValue* args) {
31 content::NotificationService::current()->Notify(
32 chrome::NOTIFICATION_NEW_TAB_READY,
33 content::Source<content::WebContents>(web_ui()->GetWebContents()),
34 content::NotificationService::NoDetails());
35 }
36
37 void NewTabPageReadyHandler::HandleNewTabPageUnexpectedNavigation(
38 const ListValue* args) {
39 // NTP reached an unexpected state trying to send finish loading notification
40 // a second time. The notification should be sent only when page is
41 // completely done loading. This could otherwise create a race condition in
42 // tests waiting for the NTP to have loaded (any navigation NTP does after
43 // loading could interfere with the test navigation).
44 NOTREACHED();
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698