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

Side by Side Diff: shell/application_manager/local_fetcher.cc

Issue 1276073004: Offline By Default (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "shell/application_manager/local_fetcher.h" 5 #include "shell/application_manager/local_fetcher.h"
6 6
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Async for consistency with network case. 84 // Async for consistency with network case.
85 base::MessageLoop::current()->PostTask( 85 base::MessageLoop::current()->PostTask(
86 FROM_HERE, base::Bind(callback, path_, base::PathExists(path_))); 86 FROM_HERE, base::Bind(callback, path_, base::PathExists(path_)));
87 } 87 }
88 88
89 std::string LocalFetcher::MimeType() { 89 std::string LocalFetcher::MimeType() {
90 return ""; 90 return "";
91 } 91 }
92 92
93 bool LocalFetcher::HasMojoMagic() { 93 bool LocalFetcher::HasMojoMagic() {
94 std::string magic; 94 return Fetcher::HasMojoMagic(path_);
95 ReadFileToString(path_, &magic, strlen(kMojoMagic));
96 return magic == kMojoMagic;
97 } 95 }
98 96
99 bool LocalFetcher::PeekFirstLine(std::string* line) { 97 bool LocalFetcher::PeekFirstLine(std::string* line) {
100 std::string start_of_file; 98 return Fetcher::PeekFirstLine(path_, line);
101 ReadFileToString(path_, &start_of_file, kMaxShebangLength);
102 size_t return_position = start_of_file.find('\n');
103 if (return_position == std::string::npos)
104 return false;
105 *line = start_of_file.substr(0, return_position + 1);
106 return true;
107 } 99 }
108 100
109 } // namespace shell 101 } // namespace shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698