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

Side by Side Diff: experimental/webtry/webtry.go

Issue 252993003: Add a magnifier lens to the image. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « experimental/webtry/templates/workspace.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package main 1 package main
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
5 "crypto/md5" 5 "crypto/md5"
6 "database/sql" 6 "database/sql"
7 "encoding/base64" 7 "encoding/base64"
8 "encoding/json" 8 "encoding/json"
9 "flag" 9 "flag"
10 "fmt" 10 "fmt"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if _, err := db.Exec("INSERT INTO workspacetry (name, hash) VALU ES(?, ?)", workspaceName, hash); err != nil { 332 if _, err := db.Exec("INSERT INTO workspacetry (name, hash) VALU ES(?, ?)", workspaceName, hash); err != nil {
333 log.Printf("ERROR: Failed to insert into workspacetry ta ble: %q\n", err) 333 log.Printf("ERROR: Failed to insert into workspacetry ta ble: %q\n", err)
334 } 334 }
335 } 335 }
336 } 336 }
337 337
338 func cssHandler(w http.ResponseWriter, r *http.Request) { 338 func cssHandler(w http.ResponseWriter, r *http.Request) {
339 http.ServeFile(w, r, "css/webtry.css") 339 http.ServeFile(w, r, "css/webtry.css")
340 } 340 }
341 341
342 func jsHandler(w http.ResponseWriter, r *http.Request) {
343 http.ServeFile(w, r, "js/run.js")
344 }
345
346 // imageHandler serves up the PNG of a specific try. 342 // imageHandler serves up the PNG of a specific try.
347 func imageHandler(w http.ResponseWriter, r *http.Request) { 343 func imageHandler(w http.ResponseWriter, r *http.Request) {
348 log.Printf("Image Handler: %q\n", r.URL.Path) 344 log.Printf("Image Handler: %q\n", r.URL.Path)
349 if r.Method != "GET" { 345 if r.Method != "GET" {
350 http.NotFound(w, r) 346 http.NotFound(w, r)
351 return 347 return
352 } 348 }
353 match := imageLink.FindStringSubmatch(r.URL.Path) 349 match := imageLink.FindStringSubmatch(r.URL.Path)
354 if len(match) != 2 { 350 if len(match) != 2 {
355 http.NotFound(w, r) 351 http.NotFound(w, r)
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 657 }
662 658
663 func main() { 659 func main() {
664 flag.Parse() 660 flag.Parse()
665 http.HandleFunc("/i/", imageHandler) 661 http.HandleFunc("/i/", imageHandler)
666 http.HandleFunc("/w/", workspaceHandler) 662 http.HandleFunc("/w/", workspaceHandler)
667 http.HandleFunc("/recent/", recentHandler) 663 http.HandleFunc("/recent/", recentHandler)
668 http.HandleFunc("/iframe/", iframeHandler) 664 http.HandleFunc("/iframe/", iframeHandler)
669 http.HandleFunc("/json/", tryInfoHandler) 665 http.HandleFunc("/json/", tryInfoHandler)
670 http.HandleFunc("/css/", cssHandler) 666 http.HandleFunc("/css/", cssHandler)
671 » http.HandleFunc("/js/", jsHandler) 667 » http.Handle("/js/", http.FileServer(http.Dir("./")))
672 // TODO Break out /c/ as it's own handler. 668 // TODO Break out /c/ as it's own handler.
673 http.HandleFunc("/", mainHandler) 669 http.HandleFunc("/", mainHandler)
674 log.Fatal(http.ListenAndServe(*port, nil)) 670 log.Fatal(http.ListenAndServe(*port, nil))
675 } 671 }
OLDNEW
« no previous file with comments | « experimental/webtry/templates/workspace.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698