| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_IMPORTER_H_ | 6 #define CHROME_BROWSER_IMPORTER_IMPORTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // And it will be run in file thread by ImporterHost. Since we do async | 24 // And it will be run in file thread by ImporterHost. Since we do async |
| 25 // import, the importer should invoke ImporterHost::NotifyImportEnded() to | 25 // import, the importer should invoke ImporterHost::NotifyImportEnded() to |
| 26 // notify its host that import stuff have been finished. | 26 // notify its host that import stuff have been finished. |
| 27 virtual void StartImport(const importer::SourceProfile& source_profile, | 27 virtual void StartImport(const importer::SourceProfile& source_profile, |
| 28 uint16 items, | 28 uint16 items, |
| 29 ImporterBridge* bridge) = 0; | 29 ImporterBridge* bridge) = 0; |
| 30 | 30 |
| 31 // Cancels the import process. | 31 // Cancels the import process. |
| 32 virtual void Cancel(); | 32 virtual void Cancel(); |
| 33 | 33 |
| 34 void set_import_to_bookmark_bar(bool import_to_bookmark_bar) { | |
| 35 import_to_bookmark_bar_ = import_to_bookmark_bar; | |
| 36 } | |
| 37 | |
| 38 void set_bookmark_bar_disabled(bool bookmark_bar_disabled) { | |
| 39 bookmark_bar_disabled_ = bookmark_bar_disabled; | |
| 40 } | |
| 41 | |
| 42 bool bookmark_bar_disabled() { return bookmark_bar_disabled_; } | |
| 43 bool cancelled() const { return cancelled_; } | 34 bool cancelled() const { return cancelled_; } |
| 44 | 35 |
| 45 protected: | 36 protected: |
| 46 friend class base::RefCountedThreadSafe<Importer>; | 37 friend class base::RefCountedThreadSafe<Importer>; |
| 47 | 38 |
| 48 Importer(); | 39 Importer(); |
| 49 virtual ~Importer(); | 40 virtual ~Importer(); |
| 50 | 41 |
| 51 // Given raw image data, decodes the icon, re-sampling to the correct size as | 42 // Given raw image data, decodes the icon, re-sampling to the correct size as |
| 52 // necessary, and re-encodes as PNG data in the given output vector. Returns | 43 // necessary, and re-encodes as PNG data in the given output vector. Returns |
| 53 // true on success. | 44 // true on success. |
| 54 static bool ReencodeFavicon(const unsigned char* src_data, | 45 static bool ReencodeFavicon(const unsigned char* src_data, |
| 55 size_t src_len, | 46 size_t src_len, |
| 56 std::vector<unsigned char>* png_data); | 47 std::vector<unsigned char>* png_data); |
| 57 | 48 |
| 58 bool import_to_bookmark_bar() const { return import_to_bookmark_bar_; } | |
| 59 | |
| 60 scoped_refptr<ImporterBridge> bridge_; | 49 scoped_refptr<ImporterBridge> bridge_; |
| 61 | 50 |
| 62 private: | 51 private: |
| 63 // True if the importer is created in the first run UI. | |
| 64 bool import_to_bookmark_bar_; | |
| 65 | |
| 66 // Whether bookmark bar is disabled (not shown) for importer. This is set | |
| 67 // true during first run to prevent out of process bookmark importer from | |
| 68 // updating bookmark bar settings. | |
| 69 bool bookmark_bar_disabled_; | |
| 70 | |
| 71 // True if the caller cancels the import process. | 52 // True if the caller cancels the import process. |
| 72 bool cancelled_; | 53 bool cancelled_; |
| 73 | 54 |
| 74 DISALLOW_COPY_AND_ASSIGN(Importer); | 55 DISALLOW_COPY_AND_ASSIGN(Importer); |
| 75 }; | 56 }; |
| 76 | 57 |
| 77 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_H_ | 58 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_H_ |
| OLD | NEW |