Skip to content

Commit

Permalink
Hook up load error page on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
gruehle committed Jun 20, 2012
1 parent 675aae1 commit ce550e0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Binary file modified bin/win/Brackets.exe
Binary file not shown.
1 change: 1 addition & 0 deletions src/win/cefclient/Resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
#define IDS_EXTENSIONPERF 1009
#define IDS_TRANSPARENCY 1010
#define IDS_BRACKETS_EXTENSIONS 1011
#define IDS_BRACKETS_LOAD_ERROR 1012

// Avoid files associated with MacOS
#define _X86_
Expand Down
7 changes: 7 additions & 0 deletions src/win/cefclient/cefclient_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
pStr++;
}

// Make sure the file exists
if (GetFileAttributes(initialUrl) == INVALID_FILE_ATTRIBUTES) {
// Load the special "brackets/load_error" url. This will be
// redirected to the error page in ClientHandler::OnBeforeResourceLoad().
wcscpy(initialUrl, L"http://brackets/load_error");
}

// Create the new child browser window
CefBrowser::CreateBrowser(info,
static_cast<CefRefPtr<CefClient> >(g_handler),
Expand Down
8 changes: 8 additions & 0 deletions src/win/cefclient/client_handler_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ bool ClientHandler::OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
REQUIRE_IO_THREAD();

std::string url = request->GetURL();
if (url == "http://brackets/load_error") {
// Show the load error page
resourceStream = GetBinaryResourceReader(IDS_BRACKETS_LOAD_ERROR);
response->SetMimeType("text/html");
response->SetStatus(200);
}
/*
if(url == "http://tests/request") {
// Show the request contents
std::string dump;
Expand Down Expand Up @@ -268,6 +275,7 @@ bool ClientHandler::OnBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
response->SetMimeType("text/html");
response->SetStatus(200);
}
*/

return false;
}
Expand Down

0 comments on commit ce550e0

Please sign in to comment.