summaryrefslogtreecommitdiff
path: root/chromium/chrome/renderer/extensions/notifications_native_handler.h
blob: 4ab7e8c1f2f66c8268e4bfc15bfc1450cd56edfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// 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_RENDERER_EXTENSIONS_NOTIFICATIONS_NATIVE_HANDLER_H_
#define CHROME_RENDERER_EXTENSIONS_NOTIFICATIONS_NATIVE_HANDLER_H_

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "extensions/renderer/object_backed_native_handler.h"

namespace base {
class Value;
}

namespace extensions {

class NotificationsNativeHandler : public ObjectBackedNativeHandler {
 public:
  explicit NotificationsNativeHandler(ScriptContext* context);

  // ObjectBackedNativeHandler:
  void AddRoutes() override;

 private:
  // This implements notifications_private.GetImageSizes() which
  // informs the renderer of the actual rendered size of each
  // component of a notification.  It additionally includes
  // information about the system's maximum scale factor so that
  // larger images specified in DP can be interpreted as scaled
  // versions of the DIP size.
  //   * |args| is used only to get the return value.
  //   * The return value contains the following keys:
  //         scaleFactor - a float a la devicePixelRatio
  //         icon - a dictionary with integer keys "height" and "width" (DIPs)
  //         image - a dictionary of the same format as |icon|
  //         buttonIcon - a dictionary of the same format as |icon|
  void GetNotificationImageSizes(
      const v8::FunctionCallbackInfo<v8::Value>& args);

  DISALLOW_COPY_AND_ASSIGN(NotificationsNativeHandler);
};

}  // namespace extensions

#endif  // CHROME_RENDERER_EXTENSIONS_NOTIFICATIONS_NATIVE_HANDLER_H_