Skip to content

Commit

Permalink
[invalidations] Created a stub about:invalidations
Browse files Browse the repository at this point in the history
Added the minimum changes necessary to get the about:invalidations
page to display a "Works" text in HTML. In following patches,
functionality will be added to display the connection status,
the invalidations count for each datatype and other debugging
information.

Work was based on signin work carried out in issue=11377015 and
following patches.

BUG=263863

Review URL: https://codereview.chromium.org/144093005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248029 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mferreria@google.com committed Jan 30, 2014
1 parent 9043979 commit f17be76
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chrome/browser/browser_about_handler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) {
GURL(chrome_prefix + chrome::kChromeUISyncHost),
GURL(chrome_prefix + chrome::kChromeUISyncInternalsHost)
},
{
GURL(chrome_prefix + chrome::kChromeUIInvalidationsHost),
GURL(chrome_prefix + chrome::kChromeUIInvalidationsHost)
},
{
GURL(chrome_prefix + "host/path?query#ref"),
GURL(chrome_prefix + "host/path?query#ref"),
Expand Down
8 changes: 8 additions & 0 deletions chrome/browser/resources/about_invalidations.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* Copyright 2014 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

/*
* TODO(mferreria): Implement this CSS. See http://crbug.com/263863
*/
17 changes: 17 additions & 0 deletions chrome/browser/resources/about_invalidations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<title>Invalidations</title>
<script src="chrome://resources/js/cr.js"></script>
<script src="chrome://resources/js/parse_html_subset.js"></script>
<script src="chrome://resources/js/util.js"></script>
<script src="chrome://invalidations/about_invalidations.js"></script>
<link rel="stylesheet" type="text/css" href="about_invalidations.css">
</head>

<body>
<h1>Invalidations Debug Information
<button id='refresh-invalidation-data'>Refresh</button></h1>
</body>


</html>
8 changes: 8 additions & 0 deletions chrome/browser/resources/about_invalidations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.


// TODO(mferreria): Implement in this JS the ability to get from the C++ Layer
// the invalidations history and display them as they come.
// See http://crbug.com/263863
16 changes: 16 additions & 0 deletions chrome/browser/resources/invalidations_resources.grd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1">
<outputs>
<output filename="grit/invalidations_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="invalidations_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_ABOUT_INVALIDATIONS_HTML" file="about_invalidations.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
<include name="IDR_ABOUT_INVALIDATIONS_JS" file="about_invalidations.js" type="BINDATA" />
<include name="IDR_ABOUT_INVALIDATIONS_CSS" file="about_invalidations.css" type="BINDATA" />
</includes>
</release>
</grit>
3 changes: 3 additions & 0 deletions chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "chrome/browser/ui/webui/identity_internals_ui.h"
#include "chrome/browser/ui/webui/inspect_ui.h"
#include "chrome/browser/ui/webui/instant_ui.h"
#include "chrome/browser/ui/webui/invalidations_ui.h"
#include "chrome/browser/ui/webui/memory_internals/memory_internals_ui.h"
#include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
Expand Down Expand Up @@ -260,6 +261,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<HistoryUI>;
if (url.host() == chrome::kChromeUIInstantHost)
return &NewWebUI<InstantUI>;
if (url.host() == chrome::kChromeUIInvalidationsHost)
return &NewWebUI<InvalidationsUI>;
if (url.host() == chrome::kChromeUIManagedUserPassphrasePageHost)
return &NewWebUI<ConstrainedWebDialogUI>;
if (url.host() == chrome::kChromeUIMemoryInternalsHost)
Expand Down
31 changes: 31 additions & 0 deletions chrome/browser/ui/webui/invalidations_ui.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/webui/invalidations_ui.h"

#include "chrome/browser/profiles/profile.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/invalidations_resources.h"

content::WebUIDataSource* CreateInvalidationsHTMLSource() {
// This is done once per opening of the page
// This method does not fire when refreshing the page
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIInvalidationsHost);
source->AddResourcePath("about_invalidations.js", IDR_ABOUT_INVALIDATIONS_JS);
source->SetDefaultResource(IDR_ABOUT_INVALIDATIONS_HTML);
return source;
}

InvalidationsUI::InvalidationsUI(content::WebUI* web_ui)
: WebUIController(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
if (profile) {
content::WebUIDataSource::Add(profile, CreateInvalidationsHTMLSource());
}
}

InvalidationsUI::~InvalidationsUI() { }
22 changes: 22 additions & 0 deletions chrome/browser/ui/webui/invalidations_ui.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_UI_H_
#define CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_UI_H_

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "content/public/browser/web_ui_controller.h"

// The implementation for the chrome://invalidations page.
class InvalidationsUI : public content::WebUIController {
public:
explicit InvalidationsUI(content::WebUI* web_ui);
virtual ~InvalidationsUI();

private:
DISALLOW_COPY_AND_ASSIGN(InvalidationsUI);
};

#endif // CHROME_BROWSER_UI_WEBUI_INVALIDATIONS_UI_H_
2 changes: 2 additions & 0 deletions chrome/chrome_browser_ui.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,8 @@
'browser/ui/webui/inspect_ui.h',
'browser/ui/webui/instant_ui.cc',
'browser/ui/webui/instant_ui.h',
'browser/ui/webui/invalidations_ui.cc',
'browser/ui/webui/invalidations_ui.h',
'browser/ui/webui/media/webrtc_logs_ui.cc',
'browser/ui/webui/media/webrtc_logs_ui.h',
'browser/ui/webui/memory_internals/memory_internals_handler.cc',
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_repack_resources.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/webui_resources.pak',
'<(grit_out_dir)/browser_resources.pak',
'<(grit_out_dir)/common_resources.pak',
'<(grit_out_dir)/invalidations_resources.pak',
'<(grit_out_dir)/memory_internals_resources.pak',
'<(grit_out_dir)/net_internals_resources.pak',
'<(grit_out_dir)/signin_internals_resources.pak',
Expand Down
7 changes: 7 additions & 0 deletions chrome/chrome_resources.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
},
'includes': [ '../build/grit_action.gypi' ],
},
{
'action_name': 'invalidations_resources',
'variables': {
'grit_grd_file': 'browser/resources/invalidations_resources.grd',
},
'includes': ['../build/grit_action.gypi' ],
},
{
'action_name': 'signin_internals_resources',
'variables': {
Expand Down
3 changes: 3 additions & 0 deletions chrome/common/url_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const char kChromeUIHistoryFrameURL[] = "chrome://history-frame/";
const char kChromeUIIdentityInternalsURL[] = "chrome://identity-internals/";
const char kChromeUIInspectURL[] = "chrome://inspect/";
const char kChromeUIInstantURL[] = "chrome://instant/";
const char kChromeUIInvalidationsURL[] = "chrome://invalidations/";
const char kChromeUIIPCURL[] = "chrome://ipc/";
const char kChromeUIManagedUserPassphrasePageURL[] =
"chrome://managed-user-passphrase/";
Expand Down Expand Up @@ -180,6 +181,7 @@ const char kChromeUIHistoryFrameHost[] = "history-frame";
const char kChromeUIIdentityInternalsHost[] = "identity-internals";
const char kChromeUIInspectHost[] = "inspect";
const char kChromeUIInstantHost[] = "instant";
const char kChromeUIInvalidationsHost[] = "invalidations";
const char kChromeUIIPCHost[] = "ipc";
const char kChromeUIKillHost[] = "kill";
const char kChromeUIManagedUserPassphrasePageHost[] = "managed-user-passphrase";
Expand Down Expand Up @@ -548,6 +550,7 @@ const char* const kChromeHostURLs[] = {
kChromeUIFlagsHost,
kChromeUIHelpHost,
kChromeUIHistoryHost,
kChromeUIInvalidationsHost,
kChromeUIIPCHost,
kChromeUIMemoryHost,
kChromeUIMemoryInternalsHost,
Expand Down
2 changes: 2 additions & 0 deletions chrome/common/url_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern const char kChromeUIHistoryFrameURL[];
extern const char kChromeUIIdentityInternalsURL[];
extern const char kChromeUIInspectURL[];
extern const char kChromeUIInstantURL[];
extern const char kChromeUIInvalidationsURL[];
extern const char kChromeUIIPCURL[];
extern const char kChromeUIManagedUserPassphrasePageURL[];
extern const char kChromeUIMemoryRedirectURL[];
Expand Down Expand Up @@ -172,6 +173,7 @@ extern const char kChromeUIHistoryFrameHost[];
extern const char kChromeUIIdentityInternalsHost[];
extern const char kChromeUIInspectHost[];
extern const char kChromeUIInstantHost[];
extern const char kChromeUIInvalidationsHost[];
extern const char kChromeUIIPCHost[];
extern const char kChromeUIKillHost[];
extern const char kChromeUIManagedUserPassphrasePageHost[];
Expand Down
1 change: 1 addition & 0 deletions chrome/test/functional/special_tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def GetSpecialAcceleratorTabs():
'chrome://flags': {},
'chrome://flash': {},
'chrome://gpu-internals': {},
'chrome://invalidations': { 'title': 'Invalidations' },
'chrome://histograms': { 'title': 'About Histograms' },
'chrome://history': { 'title': 'History' },
'chrome://inspect': { 'title': 'Inspect with Chrome Developer Tools' },
Expand Down
3 changes: 3 additions & 0 deletions tools/gritsettings/resource_ids
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@
"chrome/browser/resources/signin_internals_resources.grd": {
"includes": [21750],
},
"chrome/browser/resources/invalidations_resources.grd": {
"includes": [21950],
},
# This file is generated during the build.
"<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd": {
"includes": [22000],
Expand Down

0 comments on commit f17be76

Please sign in to comment.