summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_global_error_badge.cc
blob: b2578dfb6ec99781490c261da1b643716d4e99c7 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) 2012 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/extensions/extension_global_error_badge.h"

#include "base/logging.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"

ExtensionGlobalErrorBadge::ExtensionGlobalErrorBadge() {}

ExtensionGlobalErrorBadge::~ExtensionGlobalErrorBadge() {}

bool ExtensionGlobalErrorBadge::HasBadge() {
  return true;
}

bool ExtensionGlobalErrorBadge::HasMenuItem() {
  return true;
}

int ExtensionGlobalErrorBadge::MenuItemCommandID() {
  return GetMenuItemCommandID();
}

string16 ExtensionGlobalErrorBadge::MenuItemLabel() {
  return l10n_util::GetStringUTF16(IDS_EXTENSION_WARNINGS_WRENCH_MENU_ITEM);
}

void ExtensionGlobalErrorBadge::ExecuteMenuItem(Browser* browser) {
  ExtensionService* extension_service =
      browser->profile()->GetExtensionService();

  // Suppress all current warnings in the extension service from triggering
  // a badge on the wrench menu in the future of this session.
  extension_service->extension_warnings()->SuppressBadgeForCurrentWarnings();

  browser->ExecuteCommand(IDC_MANAGE_EXTENSIONS);
}

bool ExtensionGlobalErrorBadge::HasBubbleView() {
  return false;
}

string16 ExtensionGlobalErrorBadge::GetBubbleViewTitle() {
  return string16();
}

string16 ExtensionGlobalErrorBadge::GetBubbleViewMessage() {
  return string16();
}

string16 ExtensionGlobalErrorBadge::GetBubbleViewAcceptButtonLabel() {
  return string16();
}

string16 ExtensionGlobalErrorBadge::GetBubbleViewCancelButtonLabel() {
  return string16();
}

void ExtensionGlobalErrorBadge::OnBubbleViewDidClose(Browser* browser) {
}

void ExtensionGlobalErrorBadge::BubbleViewAcceptButtonPressed(
    Browser* browser) {
  NOTREACHED();
}

void ExtensionGlobalErrorBadge::BubbleViewCancelButtonPressed(
    Browser* browser) {
  NOTREACHED();
}

// static
int ExtensionGlobalErrorBadge::GetMenuItemCommandID() {
  return IDC_EXTENSION_ERRORS;
}