Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: components/translate/content/browser/browser_cld_data_provider.h

Issue 461633002: Refactor language detection logic to allow non-static CLD data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error in chrome/browser/BUILD.gn Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/translate/content/browser/browser_cld_data_provider.h
diff --git a/components/translate/content/browser/browser_cld_data_provider.h b/components/translate/content/browser/browser_cld_data_provider.h
index 4e8776ae07b110d93dc02030d597d7df468a1781..a01f8f75fd8de4b46a0c731f877210d35aa6d451 100644
--- a/components/translate/content/browser/browser_cld_data_provider.h
+++ b/components/translate/content/browser/browser_cld_data_provider.h
@@ -7,17 +7,13 @@
#include <string>
-#include "base/files/file_path.h"
+#include "base/compiler_specific.h"
#include "ipc/ipc_listener.h"
namespace IPC {
class Message;
}
-namespace content {
-class WebContents;
-}
-
namespace translate {
// Browser-side interface responsible for providing CLD data.
@@ -31,6 +27,7 @@ namespace translate {
// constant from ipc_message_start.h
class BrowserCldDataProvider : public IPC::Listener {
public:
+ BrowserCldDataProvider();
virtual ~BrowserCldDataProvider() {}
// IPC::Listener implementation:
@@ -38,45 +35,27 @@ class BrowserCldDataProvider : public IPC::Listener {
// OnCldDataRequest() and returns true. In all other cases, this method does
// nothing. This method is defined as virtual in order to force the
// implementation to define the specific IPC message(s) that it handles.
- virtual bool OnMessageReceived(const IPC::Message&) = 0;
+ // The default implementation does nothing and returns false.
+ virtual bool OnMessageReceived(const IPC::Message&) override;
// Called when the browser process receives an appropriate message in
// OnMessageReceived, above. The implementation should attempt to locate
// the CLD data, cache any metadata required for accessing that data, and
// ultimately trigger a response by invoking SendCldDataResponse.
- //
// The renderer process may poll for data, in which case this method may be
// repeatedly invoked. The implementation must be safe to call any number
// of times.
- virtual void OnCldDataRequest() = 0;
+ // The default implementation does nothing.
+ virtual void OnCldDataRequest() {};
jochen (gone - plz use gerrit) 2014/10/23 13:57:39 nit, no ; at EOL
Andrew Hayden (chromium.org) 2014/10/30 16:56:32 Applied everywhere, I think.
// Invoked when OnCldDataRequest, above, results in a successful lookup or
// the data is already cached and ready to respond to. The implementation
// should take whatever action is appropriate for responding to the paired
// RendererCldDataProvider, typically by sending an IPC response.
- virtual void SendCldDataResponse() = 0;
+ // The default implementation does nothing.
+ virtual void SendCldDataResponse() {};
};
jochen (gone - plz use gerrit) 2014/10/23 13:57:39 disallow copy/assign
Andrew Hayden (chromium.org) 2014/10/30 16:56:32 Done.
-// Static factory function defined by the implementation that produces a new
-// provider for the specified WebContents.
-BrowserCldDataProvider* CreateBrowserCldDataProviderFor(
- content::WebContents*);
-
-// For data sources that support a separate CLD data file, configures the path
-// of that data file.
-//
-// The 'component' and 'standalone' data sources need this method to be called
-// in order to locate the CLD data on disk.
-// If the data source doesn't need or doesn't support such configuration, this
-// function should do nothing. This is the case for, e.g., the static data
-// source.
-void SetCldDataFilePath(const base::FilePath& path);
-
-// Returns the path most recently set by SetCldDataFilePath. The initial value
-// prior to any such call is the empty path. If the data source doesn't support
-// a data file, returns the empty path.
-base::FilePath GetCldDataFilePath();
-
} // namespace translate
#endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_BROWSER_CLD_DATA_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698