Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / renderer / net / net_error_page_controller.h
blobdc50a6666c60343493ecee50fa9291cc8ce8f424
1 // Copyright 2014 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 #ifndef CHROME_RENDERER_NET_NET_ERROR_PAGE_CONTROLLER_H_
6 #define CHROME_RENDERER_NET_NET_ERROR_PAGE_CONTROLLER_H_
8 #include "base/macros.h"
9 #include "components/error_page/renderer/net_error_helper_core.h"
10 #include "content/public/renderer/render_frame_observer.h"
11 #include "gin/arguments.h"
12 #include "gin/wrappable.h"
15 namespace content {
16 class RenderFrame;
19 // This class makes various helper functions available to the
20 // error page loaded by NetErrorHelper. It is bound to the JavaScript
21 // window.errorPageController object.
22 class NetErrorPageController
23 : public gin::Wrappable<NetErrorPageController>,
24 public content::RenderFrameObserver {
25 public:
26 static gin::WrapperInfo kWrapperInfo;
28 static void Install(content::RenderFrame* render_frame);
30 private:
31 explicit NetErrorPageController(content::RenderFrame* render_frame);
32 ~NetErrorPageController() override;
34 // Execute a "Show saved copy" button click.
35 bool ShowSavedCopyButtonClick();
37 // Execute a "Reload" button click.
38 bool ReloadButtonClick();
40 // Execute a "Details" button click.
41 bool DetailsButtonClick();
43 // Track easter egg plays.
44 bool TrackEasterEgg();
46 // Track "Show cached copy/page" button clicks.
47 bool TrackCachedCopyButtonClick(bool is_default_label);
49 // Track a click when the page has suggestions from the navigation correction
50 // service.
51 bool TrackClick(const gin::Arguments& args);
53 // Used internally by other button click methods.
54 bool ButtonClick(error_page::NetErrorHelperCore::Button button);
56 // gin::WrappableBase
57 gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
58 v8::Isolate* isolate) override;
60 // RenderFrameObserver. Overridden to avoid being destroyed when RenderFrame
61 // goes away; NetErrorPageController objects are owned by the JS
62 // garbage collector.
63 void OnDestruct() override;
65 DISALLOW_COPY_AND_ASSIGN(NetErrorPageController);
68 #endif // CHROME_RENDERER_NET_NET_ERROR_PAGE_CONTROLLER_H_