<commit_before>// Copyright 2013 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_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_

#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/common/extensions/api/feedback_private.h"
#include "ui/gfx/rect.h"

namespace extensions {

class FeedbackService;

using extensions::api::feedback_private::SystemInformation;

class FeedbackPrivateAPI : public ProfileKeyedAPI {
 public:
  explicit FeedbackPrivateAPI(Profile* profile);
  virtual ~FeedbackPrivateAPI();

  FeedbackService* GetService() const;
  void RequestFeedback(const std::string& description_template,
                       const std::string& category_tag,
                       const GURL& page_url,
                       const gfx::Rect& screen_size);

  // ProfileKeyedAPI implementation.
  static ProfileKeyedAPIFactory<FeedbackPrivateAPI>* GetFactoryInstance();

 private:
  friend class ProfileKeyedAPIFactory<FeedbackPrivateAPI>;

  // ProfileKeyedAPI implementation.
  static const char* service_name() {
    return "FeedbackPrivateAPI";
  }

  Profile* const profile_;
  FeedbackService* service_;
};

// Feedback strings.
class FeedbackPrivateGetStringsFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getStrings",
                             FEEDBACKPRIVATE_GETSTRINGS)

 protected:
  virtual ~FeedbackPrivateGetStringsFunction() {}
<commit_msg>Fix Chrome crash when opening feedback in incognito.<commit_after>// Copyright 2013 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_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_

#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/common/extensions/api/feedback_private.h"
#include "ui/gfx/rect.h"

namespace extensions {

class FeedbackService;

using extensions::api::feedback_private::SystemInformation;

class FeedbackPrivateAPI : public ProfileKeyedAPI {
 public:
  explicit FeedbackPrivateAPI(Profile* profile);
  virtual ~FeedbackPrivateAPI();

  FeedbackService* GetService() const;
  void RequestFeedback(const std::string& description_template,
                       const std::string& category_tag,
                       const GURL& page_url,
                       const gfx::Rect& screen_size);

  // ProfileKeyedAPI implementation.
  static ProfileKeyedAPIFactory<FeedbackPrivateAPI>* GetFactoryInstance();

 private:
  friend class ProfileKeyedAPIFactory<FeedbackPrivateAPI>;

  // ProfileKeyedAPI implementation.
  static const char* service_name() {
    return "FeedbackPrivateAPI";
  }

  static const bool kServiceRedirectedInIncognito = true;

  Profile* const profile_;
  FeedbackService* service_;
};

// Feedback strings.
class FeedbackPrivateGetStringsFunction : public SyncExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getStrings",
                             FEEDBACKPRIVATE_GETSTRINGS)

 protected:
  virtual ~FeedbackPrivateGetStringsFunction() {}

{'fraction_non_alphanumeric': 0.07572319909245605, 'fraction_numerical': 0.0022688598979013048, 'mean_word_length': 4.634185303514377, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2562149', 'n_tokens_mistral': 1044, 'n_tokens_neox': 985, 'n_words': 224}